How to install CS-Cart v4 on an Ubuntu 14.04 VPS

cs-cartIn this tutorial, we will show how to install CS-Cart v4 on an Ubuntu 14.04 VPS with Apache, PHP and MySQL installed on it. CS-Cart is a standalone shopping cart software based on PHP and MySQ, intended for building and managing an attractive storefront of any size. This guide was tested and written for Ubuntu 14.04 VPS, but it should work on any Linux distribution.

This install guide assumes that Apache, MySQL and PHP are already installed and configured on your CS-Cart virtual server. At the time of writing this tutorial, the latest stable version of CS-Cart is 4.2.4 and it requires:

  • PHP >= 5.3 with the following PHP extensions enabled: CURL, Zip, Phar, MySQLi, GD Graphics Library version 2.0.x+ and FreeType font library. Also, safe_mode, magic_quotes_gpc, magic_quotes_runtime and magic_quotes_sybase settings should be disabled and allow_url_fopen and file_uploads setting should be enabled in php.ini
  • Apache Web Server >= 2.0 compiled with mod_rewrite module and with the following directives allowed: DirectoryIndex, Deny, Allow, Options, Order, AddHandler, RewriteEngine, RewriteBase, RewriteCond and RewriteRule.
  • MySQL >= 4.1 installed on your virtual server.

Download the latest version of CS-Cart available at to the server and extract it using the following commands:

cd /opt
unzip -d /opt/cscart

Create a new MySQL database for CS-Cart on your server:

mysql -u root -p
mysql> CREATE DATABASE cscartdb;
mysql> GRANT ALL PRIVILEGES ON cscartdb.* TO 'cscartuser'@'localhost' IDENTIFIED BY 'your-password' WITH GRANT OPTION;
mysql> quit

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘cscart.conf’:

touch /etc/apache2/sites-available/cscart.conf
ln -s /etc/apache2/sites-available/cscart.conf /etc/apache2/sites-enabled/cscart.conf

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

then, add the following lines to it:

<VirtualHost *:80>
 DocumentRoot /var/www/html/cscart/
 <Directory /var/www/html/cscart/>
 Options FollowSymLinks
 AllowOverride All
 ErrorLog /var/log/apache2/
 CustomLog /var/log/apache2/ common

Edit the php.ini configuration file and add/modify the following lines:

vi /etc/php5/apache2/php.ini

file_uploads = On
allow_url_fopen = On
safe_mode = Off
register_globals = off
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
session.auto_start = 0

Restart the Apache web server for the changes to take effect.

service apache2 restart

Move the CS-Cart installation files to the document root directory defined in the virtual host directive above:

mv /opt/cscart/ /var/www/html/cscart

Also, the webserver user (Apache) needs to be able to write to ‘/var/www/html/cscart/’ directory so you can easily accomplish that by executing the following command:

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

Set the proper file permissions for CS-Cart to write to certain files and directories:

cd /var/www/html/cscart/
chmod 666 config.local.php
chmod -R 777 design images var
find design -type f -print0 | xargs -0 chmod 666
find images -type f -print0 | xargs -0 chmod 666
find var -type f -print0 | xargs -0 chmod 666

Open in your popular web browser and follow the easy instructions.

cs-cart back-end

After finishing the installation it is strongly recommended to delete the install directory in your Apache’s document root:

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

Also, change the access permissions for the files as advised below:

chmod 644 /var/www/html/cscart/config.local.php
chmod 644 /var/www/html/cscart/design/.htaccess images/.htaccess
chmod 664 /var/www/html/cscart/var/.htaccess /var/www/html/cscart/var/themes_repository/.htaccess
chmod 644 /var/www/html/cscart/design/index.php /var/www/html/cscart/images/index.php
chmod 664 /var/www/html/cscart/var/index.php /var/www/html/cscart/var/themes_repository/index.php

Do not forget to change the default administrator password.

That is it. The CS-Cart installation is now complete. Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install CS-Cart for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Install Lychee on an Ubuntu VPS
How to Create a cPanel Account in WHM
How to install ownCloud 6 on a Linux Virtual Server