How to Create a LEMP Server Running LiteCart

  • Download CentOS from the CentOS Project website.

  • Burn a disc from the ISO file. And boot up your machine using the disc. See YouTube for guides how to install CentOS.

  • After install. Login as root and proceed with the commands below.

Install Services

#!/bin/sh

# Install some repositories
yum localinstall https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum localinstall https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

# Install some tools
yum install -y lynx nano unzip wget

# Install NGINX (See below)
yum install -y nginx

# Install MySQL
yum --enablerepo=mysql57-community install -y mysql-community-server

# Install PHP and PHP-FPM
yum --enablerepo=remi-php72 install -y php php-fpm php-bcmath php-gd php-mbstring php-mysqlnd php-mcrypt php-soap php-zip

## Configurations

#If you missed your temporary password do
grep 'temporary password' /var/log/mysqld.log

mysql_secure_installation

# Configure PHP-FPM (see below)
nano /etc/php-fpm.d/www.conf

# Configure services to start upon boot sequence
systemctl enable nginx systemctl enable mysqld systemctl enable php-fpm

# Starts services immediately
systemctl start nginx systemctl start mysqld systemctl start php-fpm

# Create index.php (echo hello world or phpinfo())
echo "" /var/www/litecart/index.php

# Open the browser and make sure you see Hello World
lynx 

# Allow incoming connections on port 80 from other computers
firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --reload 

## Install LiteCart
wget -O litecart.zip https://github.com/litecart/litecart/archive/master.zip
unzip litecart.zip litecart-master/public_html/* -d /var/www/litecart
mv /var/www/litecart/litecart-master/public_html/* /var/www/litecart/
rm -rf /var/www/litecart/litecart-master

# Add hostname to hosts
echo "127.0.0.1 litecart.local" >> /etc/hosts

# Configure NGINX (See below)
nano /etc/nginx/conf.d/litecart.conf

# Create a MySQL Database (Use your mysql root password)
mysql -uroot -p -e "CREATE DATABASE litecart; CREATE USER litecart@localhost IDENTIFIED BY 'test123test%'; GRANT ALL ON litecart.* TO litecart@localhost;"

#  Restart NGINX
systemctl start nginx

# Go to https://litecart/install to complete installation
lynx https://litecart/install

Configurations

server {

 server_name litecart;
 listen      80;

 root        /var/www/litecart;
 index       index.php index.html index.htm;

 error_page 401 "Access Forbidden";
 error_page 403 /error_document?code=403;
 error_page 404 /error_document?code=404;
 error_page 410 /error_document?code=410;
 error_page 500 "Internal Server Error";

 location / {
   try_files $uri $uri/ /index.php$is_args$args;
 }

 location ~ .php$ {
   try_files $uri =404;
   fastcgi_pass 127.0.0.1:9000;
   fastcgi_index index.php;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
   include fastcgi_params;
 }
}
...
cgi.fix_pathinfo=0
...
listen = 127.0.0.1:9000
listen.owner = nobody
listen.group = nobody
user = nginx
group = nginx

## Install Ajenti Control Panel
https://support.ajenti.org/forums/5-kb/topics/1122-installing-on-centosrhel/

#  Install repository
yum localinstall https://repo.ajenti.org/ajenti-repo-1.0-1.noarch.rpm

# Install Ajenti
yum --enablerepo=ajenti install -y ajenti

# Allow incoming connections on port 8000 from other computers
firewall-cmd --zone=public --add-port=8000/tcp --permanent
firewall-cmd --reload 

## Install a DNS Server

# Install DNS server
yum install -y bind bind-utils

# Configure to start upon boot sequence
systemctl enable named

# Start immediately
systemctl start named

Revisions

Top Editors
Recently Edited Articles