How to Install OpenCart on CentOS

How to Install OpenCart on CentOS
Status: This OS is no longer supported

This article, “How to Install OpenCart on CentOS,” covers a version of CentOS that reached end of life (EOL). It is no longer supported. As such, this guide is no longer maintained. If you are currently operating a server running CentOS 6, we highly recommend contacting RoseHosting’s fully managed support. They can upgrade or migrate you to a supported version of AlmaLinux.

e’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 a 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 a new database

First, let’s 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
Ensure you replace ‘PASSWORD’ with your actual password.
 

2. Install PHP extensions

If not already installed, add the following PHP extensions to your server:
 
# yum install php-mysql php-gd php-curl php-pecl-zip

3. Restart the 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 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 Apache user should own the OpenCart directory:

# 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
This step finalizes the command-line installation.
 

6. Continue the installation via web browser

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. The system will also prompt you to enter the name, username, and password for the newly created MySQL database. After all, do not forget to delete the installation directory:

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

    Reply
  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!

    Reply

Leave a Comment