There is a new version of this tutorial available for Ubuntu 20.04 (Focal Fossa).

How to Install LiteCart on Ubuntu 18.04 LTS

LiteCart is a free and open source e-commerce platform written in PHP, jQuery, and HTML5. It is simple, lightweight and easy to use software platform that helps you to host your own shopping cart. LiteCart comes with lots of features such as being Lightweight, Unlimited categories, Multiple languages, Unlimited products, Modern web interface, Logical user interface and much more.

In this tutorial, we will learn how to install LiteCart on Ubuntu 18.04 server.

Requirements

  • A server running Ubuntu 18.04.
  • A root password is set up to your server.

Getting Started

Before starting, you will need to update your system with the latest version. You can do this by running the following command:

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

Once your server is updated, restart your server to apply the changes.

Install LAMP Server

First, you will need to install Apache web server, MariaDB, PHP and other required packages to your server. You can install all of them by running the following command:

apt-get install apache2 mariadb-server php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-intl php7.2-mysql php7.2-cli php7.2-zip php7.2-curl php7.2-soap unzip -y

Once all the packages are installed, start Apache and MariaDB service and enable them to start on boot time with the following command:

systemctl start apache2
systemctl start mariadb
systemctl enable apache2
systemctl enable mariadb

Next, you will need to open php.ini file and make some changes:

nano /etc/php/7.2/apache2/php.ini

Change the following lines:

memory_limit = 256M
upload_max_filesize = 150M
max_execution_time = 360
date.timezone = Asia/Kolkata

Save and close the file, when you are finished. Then, proceed to the next step.

Configure MariaDB

By default, MariaDB is not secured. So, you will need to secure it first. You can secure it using the following script:

mysql_secure_installation

This command will change root password, remove anonymous users, disallow root login remotely and remove test database and access to it as shown in the following output :

    Enter current password for root (enter for none):
    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 the MariaDB is secured, log in to MariaDB shell with the following command:

mysql -u root -p

Provide your root password, then create a database and user for LiteCart with the following command:

MariaDB [(none)]> CREATE DATABASE litecartdb;
MariaDB [(none)]> CREATE USER 'litecart'@'localhost' IDENTIFIED BY 'password';

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

MariaDB [(none)]> GRANT ALL PRIVILEGES ON litecartdb.* TO 'litecart'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

Next, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

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

Download LiteCart

First, download the latest version of LiteCart from their official website. Once the download has been completed successfully, unzip the downloaded file to the Apache root directory with the following command:

mkdir /var/www/html/litecart
unzip litecart-2.1.6.zip -d /var/www/html/litecart

Next, give proper permissions to the litecart directory with the following command:

chown -R www-data:www-data /var/www/html/litecart/
chmod -R 755 /var/www/html/litecart/

Once you have finished, you can proceed to the next step.

Configure Apache for LiteCart

Next, you will need to create an Apache virtual host file for LiteCart. You can do it by creating litecart.conf file:

nano /etc/apache2/sites-available/litecart.conf

Add the following lines:

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName example.com
     DocumentRoot /var/www/html/litecart/public_html/

     <Directory /var/www/html/litecart/>
        AllowOverride All
        allow from all
     </Directory>

     ErrorLog /var/log/apache2/litecart_error.log
     CustomLog /var/log/apache2/litecart_access.log combined
</VirtualHost>

Save and close the file, when you are finished. Then, enable litecart virtual host file with the following command:

a2ensite litecart.conf

Next, enable the Apache header and rewrite module with the following command:

a2enmod rewrite
a2enmod headers

Finally, restart Apache service to apply all the changes with the following command:

systemctl restart apache2

You can verify the Apache status with the following command:

systemctl status apache2

If everything will be fine, you should see the following output:

? apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           ??apache2-systemd.conf
   Active: active (running) since Sun 2019-05-12 12:40:04 UTC; 6s ago
  Process: 6498 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 6517 (apache2)
    Tasks: 1 (limit: 1114)
   CGroup: /system.slice/apache2.service
           ??6517 /usr/sbin/apache2 -k start

May 12 12:40:23 ubuntu1804 systemd[1]: Starting The Apache HTTP Server...
May 12 12:40:23 ubuntu1804 apachectl[6498]: AH00557: apache2: apr_sockaddr_info_get() failed for ubuntu1804
May 12 12:40:23 ubuntu1804 apachectl[6498]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 12$
May 12 12:40:23 ubuntu1804 systemd[1]: Started The Apache HTTP Server.

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

Access LiteCart Web Interface

LiteCart is now installed and configured, it's time to access LiteCart web interface.

Open your web browser and type the URL http://example.com. You will be redirected to the following page:

Litecart System Requirements

Installation Parameters

Make sure all the required packages have been installed. Then, provide database username, database name, password, email address, Time Zone, Store Name, Country, admin username and password. Then, click on the Install Now button. Once the installation has been completed successfully, you should see the following page:

Installation successful

Now, delete the install directory with the following command:

rm -rf /var/www/html/litecart/install

Next, click on the administration area. You will be redirected to the following page:

Litecart Login

Now, provide your admin username and password which you have configured earlier and click on the login button. You should see the LiteCart dashboard in the following page:

Litecart admin dashboard

Congratulations! you have successfully installed LiteCart on Ubuntu 18.04 server. You can now host your own shopping cart easily using LiteCart. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)