How to Install OpenCart on CentOS

How to Install OpenCart on CentOS

We’ll show you, How to install OpenCart on CentOS. If you want to create and run your own online business by creating an online store, then you should consider to use OpenCart eCommerce platform. OpenCart is powerful, user friendly and free online shopping cart platform based on PHP. The installation of OpenCart on CentOS, is pretty easy and straightforward. To use OpenCart, you should have PHP, Apache and MySQL on your CentOS VPS or Fedora VPS.

1. Create new database

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.

2. Install PHP extensions

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

3. Restart Apache web server

And restart your Apache server by executing:

# /etc/init.d/httpd restart

4. Download OpenCart

Download the latest stable version of OpenCart and unpack it:

# cd /tmp
# wget && 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

5. Set up file permissions

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.

6. Continue the installation via web browser

Now, navigate your browser to 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:

6. Delete installation folder

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


Of course you don’t have to install OpenCart on CentOS,  if you use one of our OpenCart Hosting services, in which case you can simply ask our expert Linux admins to install OpenCart on CentOS, for you. They are available 24×7 and will take care of your request immediately.

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

3 thoughts on “How to Install OpenCart on CentOS”

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

  2. 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!


Leave a Comment

To prove you are human please solve the following *