• Get In Touch
May 17, 2017

How to Install LiteCart Shopping Cart on Ubuntu 16.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

LiteCart is a free and open source online catalog and shopping cart platform writtent in PHP language. It is very popular due to it’s simplicity, lightweight and easy to use web interface.

The framework is constructed to be lightweight and easy for developers to modify and build upon. LiteCart relies on the latest HyperText standard HTML 5, CSS 3, jQuery framework and PHP.

Here, we will learn how to install and configure LiteCart on your Ubuntu 15.04 server with Nginx, PHP-FPM and MySQL.

Requirements

  • A server running Ubuntu Ubuntu 16.04 server.
  • A non root user with sudo privileges setup on your server.

Update the System

Before installing any packages, it is recommended to update your system with the latest stable version. You can do this with the following command:

sudo apt-get update -y
sudo apt-get upgrade -y

Once your system is up to date, you can proceed to install Nginx web server.

Install Nginx

First, you will need to install Nginx web server on your server. You can install it with the following command:

sudo apt-get install nginx -y

Once Nginx is installed, start Nginx service and enable it to start on boot time with the following command:

sudo systemctl start nginx
sudo systemctl enable nginx

Once you are done, you can proceed to the next step.

Install PHP

Next, you will need to install PHP, PHP-FPM and other PHP libraries on your server.

You can install all of them with the following command:

sudo apt-get install php5 php5-fpm php5-mysql php5-curl php5-mcrypt php5-gd -y

Once all of them are installed, you can proceed to install MySQL server.

Install and Configure MySQL

LiteCart store it’s data in MySQL. So you will need to install MySQL on your server. You can install it by running the following command:

sudo apt-get install mysql-server mysql-client -y

Once MySQL is installed, start mysql service and enable it to start on boot time with the following command:

sudo systemctl start mysql
sudo systemctl enable mysql

By default, MySQL installation is not secured, so you will need to secure it first. Next, you will also need to secure your MySQL installation. You can do this by running mysql_secure_installation script:

sudo mysql_secure_installation

Answer all the questions as shown below:

Set root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Once MySQL is secured, log in to the MySQL shell and create a database for LiteCart:

mysql -u root -p

Enter your root password when prompt, then create a database for LiteCart. It is recommended to set secure password:

mysql>CREATE DATABASE litecartdb;
Query OK, 1 row affected (0.00 sec)

Next, create a username and password for LiteCart with the following command:

mysql>CREATE USER 'litecartuser'@'localhost' IDENTIFIED BY 'password';
Query OK, 1 row affected (0.00 sec)

Next, grant privileges to the LiteCart database with the following command:

mysql>GRANT ALL PRIVILEGES ON litecartdb.* TO 'litecartuser'@'localhost';
Query OK, 1 row affected (0.00 sec)

Next, you will need to run the FLUSH PRIVILEGES command so that the privileges table will be reloaded by MySQL and we can use new credential:

mysql>FLUSH PRIVILEGES;
Query OK, 1 row affected (0.00 sec)

Next, exit from the MySQL console with the following command:

mysql>\q

Once you are done, you can proceed to the next step.

Install LiteCart

First, you will need to download the latest version of the LiteCart from their official website. Once the download is completed.
unzip the downloaded file with the following command:

sudo mkdir /var/www/html/litecart
sudo unzip litecart-2.0.zip -d /var/www/html/litecart/

Next, give proper permission to the litecart directory:

sudo chown -R www-data:www-data /var/www/html/litecart

Once you are done, you can proceed to the next step.

Configure Nginx for LiteCart

Next, you will need to create a Nginx virtual host file for LiteCart. You can do this by creating litecart.conf file inside /etc/nginx/sites-available directory:

sudo nano /etc/nginx/sites-available/litecart.conf

Add the folowing lines:

server {
listen 80 ;

root /var/www/html/litecart/public_html;
index index.php index.html index.htm;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

server_name yourdomain.com ;

access_log /var/log/nginx/litecart-access.log;
error_log /var/log/nginx/litecart-error.log;

location / {
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?q=$uri&$args;
}

error_page 404 /404.html;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;

}
}

Next, enable your virtual host with the following command:

sudo a2ensite litecart.conf

Finally, restart Nginx for the changes to take effect:

sudo systemctl restart nginx

Once you are done, you can proceed to the next step.

Access LiteCart Web Interface

Before accessing the LiteCart Web Interface, you will need to allow HTTP service through UFW firewall.

By default UFW is disabled on your system, so you need to enable it first.
You can enable it with the following command:

sudo ufw enable

Once UFW firewall is enabled, you can allow HTTP service by running the following command:

sudo ufw allow http

You can now check the status of UFW firewall by running the following command:

sudo ufw status

Next, Open your web browser and type the URL http://yourdomain.com, you should see the following page:

HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/1504925541.png” alt=”” />

Make sure all the system requirements are fulfilled, then click on the Next button you should see the following page:

HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/295591722.png” alt=”” />

Here, provide all the information like, database name, database username, password, store name, admin username and password, then click on the Next button, you should see the following installation completed message:

HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/342247820.png” alt=”” />

Finally, click on administratio are button, you should see the LiteCart login page in following image:

HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/963458963.png” alt=”” />

Here, provide your admin credential and click on Login button, you should see the LiteCart Default dashboard in below image:

HP_NO_IMG/data/uploads/users/f36d03b4-5bf0-4986-8e72-2e14d73d9b4d/1591482462.png” alt=”” />

Congratulations! You have successfully installed LiteCart on your Ubuntu 16.04 server.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]