Categories Tutorials

How to install OpenCart on CentOS/Fedora VPS

If you want to create and run your own online business by creating an online store, then you should consider to use OpenCart. OpenCart is powerful, user friendly and free online shopping cart platform based on PHP. The installation of OpenCart is pretty easy and straightforward.

To use OpenCart, you should have PHP, Apache and MySQL on your CentOS VPS

or Fedora VPS.


First, lets create a MySQL user and database for OpenCart:

# echo "CREATE DATABASE opencartdb;" | mysql -u root -p
# echo "CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'PASSWORD';" | mysql -u root -p
# echo "GRANT ALL PRIVILEGES ON opencartdb.* TO 'opencartuser'@'localhost';" | mysql -u root -p
# echo "FLUSH PRIVILEGES;" | mysql -u root -p

Please remember that ‘PASSWORD’ should be changed with your actual password.

Install the following PHP extensions on your server if they are not already installed:

# yum install php-mysql php-gd php-curl php-pecl-zip

And restart your Apache server by executing:

# /etc/init.d/httpd restart

Download the latest stable version of OpenCart and unpack it:

# cd /tmp
# wget https://github.com/downloads/opencart/opencart/opencart_v1.5.4.1.zip && unzip opencart*

Copy all the files and directories from ‘/tmp/opencart_v1.5.4.1’ to a directory accessible by the web:

# rsync -Waq /tmp/opencart_v1.5.4.1/upload/ /var/www/html/opencart

The OpenCart directory should be owned by the Apache user:

# chown -R apache: /var/www/html/opencart

Set the correct permissions:

# cd /var/www/html/opencart
# chmod 755 image/ image/cache/ image/data/ system/cache/ system/logs/ download/ config.php admin/config.php

With this step, the installation from the command line is finished.

Now, navigate your browser to http://yourdomain.com/opencart and follow the on-screen instructions. The installation will check if the server settings match the OpenCart requirements and if the OpenCart files and directories are writable by the web server. Also you will be prompted to enter the name, username and password of the newly created MySQL database.

After all, do not forget to delete the installation directory:

# rm -rf /var/www/html/opencart/install

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 this 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.

admin :

View Comments (3)

  • I'm using Centos 6.5, having problem with chown -R /var/www/html/opencart
    The one that work is chown -R apache /var/www/html/opencart

  • Thanks for sharing up–to-date on this subject! I find it is very informative and very well written one! Keep up on this quality!