In this tutorial we’ll learn how to install OpenCart on CentOS 7. We will also install and configure its prerequisites. OpenCart is an Open source e-commerce software that allows us to build or create our own online store free of cost. Opencart is also known as shopping cart which is based on PHP.
By OpenCart 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.
I recommend to use a minimal CentOS server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install OpenCart on CentOS 7
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
yum -y install epel-release yum -y update
Step 2. Installing LAMP on Ubuntu 16.04.
You should check out this LAMP stack install tutorial for Ubuntu 16.04, if you haven’t installed LAMP yet. Once it’s installed, come back here and read on. We also will install the required packages for LAMP stack and the important PHP extension that OpenCart relies on:
apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0 php7.0-mcrypt php7.0-gd php7.0-mbstring php7.0-zip php7.0-dom php7.0-xml
Step 3. Installing OpenCart.
Next, you will need to download the latest stable version of the OpenCart. You can download it with the following command:
cd /var/www/ wget https://github.com/opencart/opencart/releases/download/220.127.116.11/18.104.22.168-OpenCart.zip -O opencart.zip unzip opencart.zip -d opencart
Now just set the right permissions for the folders:
chown -R apache:apache /var/www/opencart
You will also need to rename the configuration files. Run the following commands for same:
mv /var/www/opencart/upload/config-dist.php /var/www/opencart/upload/config.php mv /var/www/opencart/upload/admin/config-dist.php /var/www/opencart/upload/admin/config.php
Step 4. Create a database for OpenCart.
Next, we need to create a database for the OpenCart installation:
mysql -uroot -p
Run the following command to create a database for OpenCart:
MariaDB> CREATE DATABASE ocart_data; MariaDB> CREATE USER 'ocart_user'@'localhost' IDENTIFIED BY 'StrongPassword'; MariaDB> GRANT ALL PRIVILEGES ON ocart_data.* TO 'ocart_user'@'localhost'; MariaDB> FLUSH PRIVILEGES;
Step 5. Configure Web Server.
If you are using Apache as a web server, you need to edit your ‘/etc/httpd/conf/httpd.conf’ file. Open it with your favorite text editor and add the following lines:
<VirtualHost *:80> ServerAdmin email@example.com DocumentRoot /var/www/opencart/upload/ ServerName yourdomain.com ErrorLog logs/prestashop.yourdomain.com-error_log CustomLog logs/prestashop.yourdomain.com-access_log common </VirtualHost>
Save the file and restart your web server:
systemctl restart apache
Step 6. Accessing OpenCart.
Now you can access the OpenCart web install wizard in your browser by entering the domain name or http://your_ip/ to continue your OpenCart installation.
Congratulation’s! You have successfully install OpenCart on your CentOS 7 server. Thanks for using this tutorial for installing OpenCart open source e-commerce on CentOS 7 system.