OpenCart is a 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. In this post we will discuss the installation steps of OpenCart on CentOS 7.x.Before starting the installation following should be installed on your Linux system.
- Database Server ( MySQL / MariaDB )
- Web Server ( Apache )
In my case php, database server and Web server are already installed on my linux system. If in case they are not installed then use the yum command to install these packages.
Install the required PHP extension for Opencart Installation :
[[email protected] ~]# yum install php-mysql php-gd php-curl php-pecl-zip
Create Database and user for OpenCart :
connect to mysql console , run the following commands
mysql> create database shoppingcart_db; Query OK, 1 row affected (0.01 sec) mysql> create user 'shopuser'@'localhost' IDENTIFIED BY '[email protected]#'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON shoppingcart_db.* TO 'shopuser'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
Restart Web Server Services :
[[email protected] ~]# systemctl restart httpd.service
Download the latest version of OpenCart(22.214.171.124) using wget Command
[[email protected] ~]# wget https://codeload.github.com/opencart/opencart/zip/126.96.36.199 [[email protected] ~]# unzip 188.8.131.52 [[email protected] ~]# ls -ld opencart-184.108.40.206 drwxr-xr-x. 3 root root 4096 Mar 30 13:52 opencart-220.127.116.11 [[email protected] ~]# ls -l opencart-18.104.22.168 total 64 -rw-r--r--. 1 root root 2106 Mar 30 13:52 build.xml -rw-r--r--. 1 root root 2256 Mar 30 13:52 changelog.md -rw-r--r--. 1 root root 2577 Mar 30 13:52 install.txt -rw-r--r--. 1 root root 34529 Mar 30 13:52 license.txt -rw-r--r--. 1 root root 3042 Mar 30 13:52 README.md -rw-r--r--. 1 root root 5897 Mar 30 13:52 upgrade.txt drwxr-xr-x. 7 root root 4096 Mar 30 13:52 upload [[email protected] ~]#
Create opencart directory under /var/www/html and sync or copy all the files of upload folder to opencart folder using rsync command
[[email protected] ~]# mkdir /var/www/html/opencart [[email protected] ~]# rsync -Waq opencart-22.214.171.124/upload/* /var/www/html/opencart/
Set the Required Permissions
[[email protected] ~]# chown -R apache /var/www/html/opencart/ [[email protected] ~]# cd /var/www/html/opencart/ [[email protected] opencart]# mv config-dist.php config.php [[email protected] opencart]# chmod 755 config.php [[email protected] opencart]# cd admin/ [[email protected] admin]# mv config-dist.php config.php [[email protected] admin]# chmod 755 config.php
At this point of time command line installation task is completed. Now open the web browser , type : “http://<IP_Address/FQDN_of_Your_System>/opencart” to Start the Graphical Installation .
Step:1 Accept the “License agreement”, click on continue…
Step:2 At this stage installer checks whether Web server meets all the technical requirements or not. It will also check for the required permissions.
Click on Continue…
Note : In case if you are getting this “Warning: mCrypt extension needs to be loaded for OpenCart to work!” , mCrypt is a PHP extension which is not available in the default yum repository of CentOS 7.x ,so to resolve this issue follow the below Steps :
Go to the tmp directory and run the following commands :
[[email protected] tmp]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm [[email protected] tmp]# yum install php-mcrypt [[email protected] tmp]# systemctl restart httpd.service
Step:3 Define the Database connection details along with the user name and password for admin access on opencart.
Click on continue….
Step:4 Installation Finished, delete your installation directory
Go to opencart directory , delete the install folder using rm command as shown below :
[[email protected] opencart]# rm -rf install
Step:5 Login to OpenCart Admin Panel
Open the Web Broswer type : http://192.168.1.14/opencart/admin/
Replace the ip address according to your setup. Enter the admin credentials that we have set in above steps.
After entering the credentials , OpenCart Admin Dashboard will open as shown below :
OpenCart installation is completed Now. Your online store is ready, enjoy and have fun 🙂
3 thoughts on “Installation Steps of OpenCart 2.0 on CentOS 7”
Thanks for the nice writeup. It was helpful.
I faced some issues with the file permissions. It was saying config.php as unwritable
If you are not able to proceed because of correct permissions of the files, then try to disable selinux and restart the server. It worked for me.
thanks for your post.
.htaccess content should be? my site turns 500 error code.
Thanks for sharing this helpful guide, I was having an issue while installing Opencart through SSH, Your guide helped me a lot and here’s another guide from where I got help, ‘https://www.cloudways.com/blog/how-to-install-opencart-2-ssh/’, Hope, it will help your readers as well.