OpenCart is a free and open source e-commerce web application. It is written in PHP and uses MySQL to store its database. OpenCart is an alternative of Magento and has pretty much a similar set of features.
You can easily manage products, categories, customers, coupons and orders. It also has built-in SEO and multi-store feature that means you can easily manage multiple stores from a single admin interface. You can extend its features using thousands of themes and plugins available. It supports multiple payment gateways, product reviews and ratings, reward points. It is multilingual translated into more than 40 languages and supports multi-currency. More than 342,000 entrepreneurs use OpenCart to run their business.
In this tutorial, we will install OpenCart on CentOS 7 server.
OpenCart does not require any special hardware requirements. All the required dependencies will be installed throughout the tutorial. You will need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i to switch to root user.
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Once you have your system updated, you can proceed to install the LAMP stack. Start the LAMP installation by installing Apache web server and MariaDB, which is a fork of MySQL using the following command.
yum -y install httpd mariadb-server mariadb
OpenCart can be installed on any version of PHP greater than 5.4. Since PHP v5.4 has reached end of life, we will install PHP 7 for increased performance and security. PHP 7 is not included in default YUM repository, hence you will need to add the Webtatic repository in your system. Webtatic repository requires EPEL repository to work. Run the following command to install EPEL repository.
yum -y install epel-releaseyum -y update
Now install Webtatic repository using the following commands.
Once you have PHP installed, you can check the version of PHP using the following command.
You should get output similar to this.
[root@liptan-pc ~]# php -v
PHP 7.1.5 (cli) (built: May 12 2017 21:54:58) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Now start Apache web server and enable it to start at boot time using the following command.
systemctl start httpdsystemctl enable httpd
To start MariaDB and enable it to start at boot time using the following commands.
systemctl start mariadbsystemctl enable mariadb
Now run the following commands to secure your MySQL or MariaDB installation.
It will run a small script which asks you to provide the root password for MariaDB. As we have just installed MariaDB, the root password is not set, just press enter to proceed further. It will ask you if you want to set a root password for your MariaDB installation, choose y and set a strong password for the installation. It will also ask you for removing test databases and anonymous users. Most of the questions are self-explanatory and you should answer yes or y to all the questions.
To create a database we will need to login to MySQL command line first. Run the following command for same.
mysql -u root -p
This will prompt you for the password, provide the root password of MySQL which you have set earlier. Now run the following query to create a new database for your OpenCart installation.
CREATE DATABASE ocart_data;
The above query will create a database named ocart_data. Make sure that you use semicolon at the end of each query as the query always ends with a semicolon. Once the database is created you can create a new user and grant all the permissions to the user for the database. Using root user is not recommended for the databases. To create a new database user, run the following query.
CREATE USER 'ocart_user'@'localhost' IDENTIFIED BY 'StrongPassword';
The above query will create a user with username ocart_user. You can use any preferred username instead of ocart_user. Replace StrongPassword with a strong password. Now provide the appropriate privileges to your database user over the database you have created. Run the following command.
GRANT ALL PRIVILEGES ON ocart_data.* TO 'ocart_user'@'localhost';
Now run the following command to immediately apply the changes on the database privileges.
Exit from MySQL prompt using exit command.
As we have all the dependencies ready, we can now download the install package from OpenCart website.
cd /var/wwwwget https://github.com/opencart/opencart/releases/download/126.96.36.199/188.8.131.52-compiled.zip -O opencart.zip
You can always find the link to the latest version of the application on OpenCart download page. Extract the archive using the following command.
unzip opencart.zip -d opencart
If you don't have unzip installed, you can run yum -y install unzip.
You will also need to rename the configuration files. Run the following commands for same.
Click Continue button to proceed further. In next interface, the installer will check if your system meets all the requirements to install OpenCart. If you have followed the tutorial correctly, then you will have all the requirements satisfied.
Choose the database driver as MySQLi. Provide username, password and database name which you have created earlier. Leave the default value in hostname, port and prefix text box. Provide administrator username, password and email. Click Continue button to proceed further.
OpenCart is now installed, before accessing the admin panel, you are required to delete the install folder. Run the following command for same.
rm -rf /var/www/opencart/upload/install
You can now access the shop's front end at the following URL:
If you find your cPanel disk space filling up, or an email address has hit its disk space quota, cPanel has a helpful built in Email Disk Usage tool. This will provide you with a simple to understand breakdown of how much disk space each folder for a particular email...
Although WHM will normally automatically keep itself up to date, you may want to manually check for server updates / push through an update that is pending, or it may be that you have automatic updates switched off on your cPanel server. In this guide we will show you how...
You may sometimes need to manually adjust the PHP settings on your cPanel server – for example if a site is hitting the PHP memory, or file size upload limit. WHM allows you to quickly change the settings of any PHP version installed on the server when needed, using the...