How to install OpenCart on CentOS 7.6

Installation of openCart On Centos 7.6

Opencart is free and open source e-commerce platform for online shopping application and it provides a professional and reliable foundation from which we can build a successful online store. This foundation to use, to shop a variety of users and ranging from seasoned web developers looking for a user-friendly interface for using the shop owners will just launch their online business.This tutorial covers the installation of opencart on centos 7.6

Requirements for Open cart:

Apache

Mariadb

Php and it's modules

php php-xml php-mysql php-mbstring php-zip php-soap php-curl php-gd php-ldap php-imap php-common php-mcrypt

Installation procedure

Check the Centos version by using the following command

[root@linuxhelp ~]# rpm -q centos-release
centos-release-7-6.1810.2.el7.centos.x86_64
Configure the MySQL database. Log into MySQL as a root user and make the necessary settings.
 [root@linuxhelp ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database opencart;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create user 'openuser'@localhost identified by 'Linuxc#4';
Query OK, 0 rows affected (0.06 sec)

MariaDB [(none)]> grant all privileges on opencart.* to 'openuser'@localhost;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> Ctrl-C -- exit!
Aborted

Once the database configuration is done, download the installation package of Open cart by using the wget command.

[root@linuxhelp ~]# wget https://github.com/opencart/opencart/archive/master.zip
--2019-06-01 15:34:56--  https://github.com/opencart/opencart/archive/master.zip
Resolving github.com (github.com)... 13.234.210.38
Connecting to github.com (github.com)|13.234.210.38|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/opencart/opencart/zip/master [following]
--2019-06-01 15:34:56--  https://codeload.github.com/opencart/opencart/zip/master
Resolving codeload.github.com (codeload.github.com)... 192.30.253.121
Connecting to codeload.github.com (codeload.github.com)|192.30.253.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘master.zip’

   [    <=>                                                    ] 20,733,008   968KB/s   in 24s    

2019-06-01 15:35:21 (846 KB/s) - ‘master.zip’ saved [20733008]

Once the download is completed extract the downloaded package using unzip command.

[root@linuxhelp ~]# unzip master.zip
Archive:  master.zip
08b6c68ea03b3864c663aebf5acbe3af947ca094
  creating: opencart-master/
  creating: opencart-master/.github/
  creating: opencart-master/.github/ISSUE_TEMPLATE/
 inflating: opencart-master/.github/ISSUE_TEMPLATE/bug_report.md  
 inflating: opencart-master/CHANGELOG.md  
 inflating: opencart-master/CHANGELOG_AUTO.md  
 inflating: opencart-master/README.md  
 inflating: opencart-master/build.xml
.
.
.
 inflating: opencart-master/upload/system/storage/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php  
 inflating: opencart-master/upload/system/storage/vendor/zoujingli/wechat-php-sdk/Wechat/WechatService.php  
 inflating: opencart-master/upload/system/storage/vendor/zoujingli/wechat-php-sdk/Wechat/WechatUser.php  
 inflating: opencart-master/upload/system/storage/vendor/zoujingli/wechat-php-sdk/composer.json  
 inflating: opencart-master/upload/system/storage/vendor/zoujingli/wechat-php-sdk/include.php  
 inflating: opencart-master/upload/system/storage/vendor/zoujingli/wechat-php-sdk/test.php  

Move the Open cart directory to apache root directory.

 [root@linuxhelp ~]# mv opencart-master /var/www/opencart

Set the ownership and permission for Open cart by using the following command.

 [root@linuxhelp ~]# chown -R apache:apache /var/www/opencart
 [root@linuxhelp ~]# chmod -R 755 /var/www/opencart

Configure the virtualhost for accessing the Open cart.

 [root@linuxhelp ~]# vim /etc/httpd/conf.d/opencart.conf
 <Virtualhost *:80>
        servername www.linuxhelp1.com
        documentroot /var/www/opencart/upload
<directory /var/www/opencart/upload>
allowoverride all
allow from all
</directory>
</virtualhost>

Restart the apache service by using the following command.

[root@linuxhelp ~]# systemctl restart httpd

Switch to your browser and enter the domain name.

Accept the License agreement to use the Opencart.

Check out the pre installation requirements.

List out and Rename the filename.

 [root@linuxhelp ~]# cd /var/www/opencart/upload
[root@linuxhelp upload]# ls
admin  catalog  config-dist.php  image  index.php  install  php.ini  system
[root@linuxhelp upload]# mv config-dist.php config.php

Enter into directory

 [root@linuxhelp upload]# cd admin

List out and Rename the filename.

 [root@linuxhelp admin]# ls
config-dist.php  controller  index.php  language  model  view
 [root@linuxhelp admin]# mv config-dist.php config.php

Restart the apache service

 [root@linuxhelp admin]# systemctl restart httpd

Configure the database detail and Admin account setup.

Now the installation setup is complete and to access OpenCart admin panel click on login as admin.

Now login with Admin user credential

After successful login, you will see the admin dashboard of OpenCart.

With this, the method to install Opencart on Centos 7.6 comes to an end.

FAQ
Q
After installation, it shows 404 not found while calling in browser on opencart?
A
check the document root are correctly pointed in VirtualHost.
Q
What is OpenCart?
A
OpenCart is a free and open source e-commerce platform for online shopping application and it provides a professional and reliable foundation from which we can build a successful online store. This foundation to use, to shop a variety of users and ranging from seasoned web developers looking for a user-friendly interface for using the shop owners will just launch their online business.
Q
Is there any alternative for the OpenCart software?
A
The following are the alternatives for OpenCart software:
PrestaShop
WooCommerce
Shopify
Q
How to have host entry for the OpenCart domain?
A
To have a host entry for the OpenCart do the following:
# /etc/hosts
Q
How to create Custom error and access log for Opencart?
A
Enable custom access and error log in Opencart by enabling the following in Opencart virtual host:
Errorlog /var /log /opencartdomain/error_log
Customlog /var /log /opencartdomain/access_log