How To Install CS-Cart on Ubuntu 18.04

Install CS-Cart on Ubuntu

CS-Cart is an e-commerce platform that enables sellers to set up their virtual shopping center.  It offers around 500 tools by default that makes managing an online store a breeze. It is developed using PHP and utilizes MySQL as the database. The recommended web server for CS-Cart installation is Apache as it is proven to be stable and robust.

It is currently maintained by the Simtech conglomerate. At the time of writing, CS-Cart does not offer a free version anymore – however, a free 30-day trial is available for their software.

In this article, we will show you how to install CS-Cart on Ubuntu 18.04. Our CS-Cart hosting is perfect for this.

Prerequisites:

Make sure your server meets the following minimum requirements:

  • 1 CPU Core
  • 1 GB of RAM
  • 10GB of disk space
  • Ubuntu 18.04 or later
  • Domain name pointed to your server IP address
  • Full root access

You can learn more about server requirements here.

Check for Updates and Install Dependencies

Log in to your server via SSH:

ssh username@server_ip

Be sure to replace “username” with the account name of a root user found on the server, and replace “server_ip” with the IP address of your server.

Before starting with the CS-Cart installation, it is a good idea to update the system packages to their latest versions:

sudo apt-get update
sudo apt-get upgrade

Ensure the required dependencies are installed by running the following command:

sudo apt-get install curl openssh-server ca-certificates postfix software-properties-common -y

Installing the LAMP Stack

1. Installing Apache2

Apache2 is the recommended web server by CS-Cart developers. To install it, use the following command:

apt-get install apache2

Once Apache2 is installed, we then need to enable the automatic startup of the Apache web server in case of a system restart:

systemctl enable apache2

To check whether your Apache service is running, use the following command:

systemctl status apache2

You should see the following message:

● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)

Additional Apache modules are required for CS-Cart to function properly. Use the following commands to enable the rewrite, headers, and SSL Apache modules:

a2enmod rewrite
a2enmod headers
a2enmod ssl

Restart the apache2 service to apply the changes we made:

systemctl restart apache2

2. Installing PHP v7.2

At the time of writing, the officially supported PHP version by CS-Cart is PHP version 7.2. PHP 7.2 is not the default version of PHP installed on Ubuntu 18.04, so we are required to install an additional repository. To proceed, execute the following commands:

apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update

After updating the repository, use the following command to install PHP 7.2 and libraries required by CS-Cart:

apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-sqlite3 php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-json php7.2-soap php7.2-zip  php7.2-cli php7.2-zip

To verify that you are using PHP 7.2, type the following command:

php -v

You should see the following text:

PHP 7.2.14-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jan 13 2019 10:05:45) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.14-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Additional changes in PHP’s default configuration file are required for CS-Cart to function properly. Modify PHP settings by editing the “/etc/php/7.2/apache2/php.ini” file:

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

Modify the following lines:

file_uploads = On
allow_url_fopen = On

Save and restart the Apache web server service again:

systemctl restart apache2

3. Installing MySQL Server

Ubuntu 18.04 has the latest stable version of MySQL ready for installation through the pre-installed repositories.

apt-get install mysql-server

After successfully installing it, the MySQL package has a built-in security script – running it is recommended for security purposes after installing the MySQL server.

mysql_secure_installation

For additional questions aside from setting a new password, answer the questions with:

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

To verify the version of MySQL currently installed, type the following command:

mysql -V

You should see the following text:

mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper

3. Creating our CS-Cart Database

After setting up the database server, we can now continue by setting up a database for our CS-Cart installation.

Log in to MySQL’s CLI:

mysql

Use the following lines to create the database (cscart_db) and assign the user (cscart_user) to that database using a strong password.

CREATE DATABASE cscart_db;
GRANT ALL PRIVILEGES ON cscart_db.* TO 'cscart_user'@'localhost' IDENTIFIED BY 'Password';
FLUSH PRIVILEGES;
exit;

Make sure to replace the password “Password” with a real, strong password.

To verify that we can access the newly created database with the new database user, run the following command:

mysql -u cscart_user -p cscart_db

To exit MySQL’s CLI, type:

quit

Installing CS-Cart

After setting up our LAMP stack, we can now download and install CS-Cart. At the time of writing this tutorial, the latest version is 4.9.2. There is no direct download link available – you are required to use an email address to receive a download link. To download a copy, visit https://www.cs-cart.com/download-cs-cart.html

After downloading it, you need to log in via FTP and upload the zip file in /var/www/html/cscart/ and the unzip using the following commands:

cd /var/www/html/cscart/
unzip cscart_v4.9.2.SP4.zip

Remove the downloaded file after unzipping:

rm cscart_v4.9.2.SP4.zip

Now apply the recommended file and folder permissions:

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

Creating a Virtual Host for CS-Cart

For our CS-Cart installation, it is recommended to create an individual virtual host for easy troubleshooting.

Create and modify the following file:

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

Paste the following (modify accordingly):

<VirtualHost *:80>

     ServerName cs-cart-dev.yourdomainhere.com
     ServerAlias www.cs-cart-dev.yourdomainhere.com

     ServerAdmin admin@cs-cart-dev.yourdomainhere.com

     DocumentRoot /var/www/html/cscart/

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

     <Directory /var/www/html/cscart/>
     Options FollowSymlinks
     AllowOverride All
     Order allow,deny
     Allow from all
     </Directory>

</VirtualHost>

Once configured, save the file and execute the following commands to activate the new virtual host:

a2ensite cscart.conf
systemctl restart apache2

You may now visit your website and proceed with the first-time setup.

That’s it! you now have a working e-commerce platform powered by CS-Cart on your Ubuntu 18.04 server.


Of course, you don’t have to install CS-Cart on Ubuntu 18.04 if you have an Ubuntu VPS with us. You can simply ask our support team to install CS-Cart on Ubuntu 18.04 for you. They are available 24/7 and will be able to help you with the installation.

PS. If you enjoyed reading this blog post on how to install CS-Cart on Ubuntu 18.04, feel free to share it on social networks using the shortcuts below, or simply leave a comment in the comments section. Thanks.

Leave a Comment