How to Create Own Online Shopping Store - OpenCart
Create Own Online Shopping Store in Linux Using " OpenCart"
This article explains about the creation of Own Online Shopping Store in Linux Using " OpenCart" . Opencart is an open source E-Commerce Application which is written in PHP that can be used to develop a shopping cart system similar to Amazon and Flip cart.
Demo of OpenCart Web Panel
Store Front &ndash http://demo.opencart.com/
Admin Console &ndash http://demo.opencart.com/admin/
------------------ Admin Login ------------------
Username: demo
Password: demo
Features
- Everything is Template based.
- Multi-Language and Multi-Currency Supported. It ensures your product gets a global reach.
- Built-in Product Review and Rating Features.
- Downloadable Products (viz., ebook) supported.
- Automatic Image Resizing supported.
- Everything is well documented.
- Built-in Backup and Restore tools.
- Well implemented SEO.
- Invoice Printing, Error Log and sales report are supported as well.
- Free Life time support and updates.
- Unlimited number of categories, Products and manufacturer supported.
- Features like Multi tax Rates (as in various country), Viewing Related Products, Information Page, Shipping
- Weight Calculation, Availing Discount Coupons, etc are well implemented by default.
System Prerequisite
- PHP (5.2 and above).
- MariaDB
- Web Server (Apache HTTP Server Preferred)
Requirement of PHP Libraries and Modules
Installed extensions and enabled system to install Open cart properly on the web server.
- Zlib
- GD Library
- Mcrypt
- Curl
- Mbstrings
- Zip
To Install the Apache, PHP and MariaDB
1. OpenCart requires some technical requirements such as Apache, PHP with extensions and Database (MySQL or MariaDB) to be installed on the system.
First install Apache, PHP and MariaDB using following Command.
To Install Apache
On Debian based Systems
# apt-get install apache2
On RedHat based Systems
[root@linuxhelp1 ~]# yum install httpd -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* epel: epel.mirror.net.in
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-40.el7.centos.1 will be installed
.
.
.
Installed:
httpd.x86_64 0:2.4.6-40.el7.centos.1
Complete!
To Install PHP and Extensions
On Debian based Systems
# apt-get install php5 php5-mysql libapache2-mod-php5 php5-curl php5-mcrypt
On RedHat based Systems
[root@linuxhelp1 ~]# yum install php php-mysql -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* epel: epel.mirror.net.in
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-36.1.el7_2.1 will be installed
---> Package php-mysql.x86_64 0:5.4.16-36.1.el7_2.1 will be installed
.
.
.
Installed:
php.x86_64 0:5.4.16-36.1.el7_2.1 php-mysql.x86_64 0:5.4.16-36.1.el7_2.1
Complete!
To Install MariaDB
On Debian based Systems
# apt-get install mariadb
On RedHat based Systems
[root@linuxhelp1 ~]# yum install mariadb -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* epel: ftp.riken.jp
* extras: centos.excellmedia.net
* updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.47-1.el7_2 will be installed
.
.
.
Installed:
mariadb.x86_64 1:5.5.47-1.el7_2
Complete!
Set the selinux to disabled
[root@linuxhelp1 ~]# vim /etc/sysconfig/selinux
.
.
.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@linuxhelp1 ~]# setenforce 0
To Clean the yum
[root@linuxhelp1 ~]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base epel extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
Configure the HTTP configuration file
To enable the mod_rewrite module, do the following configuration.
[root@linuxhelp1 ~]# vim /etc/httpd/conf/httpd.conf
< Directory />
AllowOverride none
Require all denied
< /Directory>
Start the Apache service using following commands.
------------------- On Debian based Systems ------------------- [root@linuxhelp1 ~]# systemctl start apache2.service ------------------- On RedHat based Systems ------------------- [root@linuxhelp1 ~]# systemctl start httpd.service
To Download and Setup OpenCart
Obtain the most recent version of OpenCart (2.0.2.0) from OpenCart website or directly from github by using the wget command.
[root@linuxhelp1 ~]# wget https://github.com/opencart/opencart/archive/master.zip
--2016-05-31 17:28:18-- https://github.com/opencart/opencart/archive/master.zip
Resolving github.com (github.com)... 192.30.252.129
Connecting to github.com (github.com)|192.30.252.129|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/opencart/opencart/zip/master [following]
--2016-05-31 17:28:19-- https://codeload.github.com/opencart/opencart/zip/master
Resolving codeload.github.com (codeload.github.com)... 192.30.252.161
Connecting to codeload.github.com (codeload.github.com)|192.30.252.161|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12647990 (12M) [application/zip]
Saving to: ‘ master.zip’
100%[==================================================> ] 12,647,990 38.6KB/s in 2m 33s
2016-05-31 17:30:54 (80.7 KB/s) - ‘ master.zip’ saved [12647990/12647990]
Copy the Downloaded the zip file to Apache Working directory and then unzip the master.zip file.
[root@linuxhelp1 ~]# cp master.zip /var/www/html
[root@linuxhelp1 ~]# cd /var/www/html
[root@linuxhelp1 html]# unzip master.zip
Archive: master.zip
d45743cb2208a2938f872896779edc6d4f97e7ca
inflating: opencart-master/CHANGELOG_AUTO.md
inflating: opencart-master/README.md
.
.
.
extracting: opencart-master/upload/system/storage/logs/index.html
inflating: opencart-master/upload/system/storage/modification/index.html
extracting: opencart-master/upload/system/storage/upload/index.html
To Change the permission of the directory and the files
[root@linuxhelp1 html]# chmod -R 775 opencart-master/
[root@linuxhelp1 html]# chown apache:apache opencart-master/
Now change the name of the PHP configuration file
[root@linuxhelp1 html]# cd opencart-master/upload/
[root@linuxhelp1 upload]# cp config-dist.php config.php
[root@linuxhelp1 upload]# cp /var/www/html/opencart-master/upload/admin/config-dist.php /var/www/html/opencart-master/upload/admin/config.php
Now configure the secure mysql
[root@linuxhelp1 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we' ll need the current password for the root user. If you' ve just installed MariaDB, and you haven' t set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorization. Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from ' localhost' . This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MariaDB comes with a database named ' test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you' ve completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
Now create the database in mariadb for the opencart
[root@linuxhelp1 html]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with or g. Your MariaDB connection id is 51 Server version: 5.5.47-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type ' help ' or ' h' for help. Type ' c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE opencartdb Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> exit Bye
To Install OpenCart Web
Navigate to the web browser and type http://< web server IP address> to access the OpenCart web installation.
Click ‘ CONTINUE‘ to Agree the License Agreement.
The next screen will displays the Pre-installation Server Setup Check, which is used to see that the server has all the required modules are installed properly and have correct permission on the OpenCart files.
We need to install the components properly on the server to meet web server requirements, if any red marks are highlighted on #1 or #2.
If there are any red marks on #3 or #4, then there is some issue with files. If everything is correctly configured with all green marks are visible press " Continue" .
Here enter the Database Credentials like Database Driver, Hostname, User-name, Password, database.
Also enter the User_name, Password and Email Address for Administrative account. Click continue when done!
These credentials will be used for logging in to Opencart Admin Panel as root, so keep it safe.
This screen shows the messages like “ Installation Complete” with the Tag Line Ready to Start Selling. It also prompt to delete the installation directory, as everything required to setup using this directory has been accomplished.
Run the below command to remove install directory.
[root@linuxhelp1 ~]# rm -rf /var/www/html/opencart-master/install
If you don' t remove the install directory, the configuration page will pop up again and again.
To Access the OpenCart Web and Admin
Now open the browser with http://< web server IP address> /opencart-master/ and it shows something like the below screenshot.
To Login the Opencart Admin Panel, open the browser with http://< web server IP address> /opencart-master/admin and fill the Admin Credentials while setting it up.
Here the Admin Dashboard of Opencart is displayed if everything is ok.
In Admin Dashboard set up a lots of options like categories, product, options, Manufacturers, Downloads, Review, Information, Extension Installer, Shipping, Payment options, order totals, gift voucher, PayPal, Coupons, Affiliates, marketing, mails, Design and Settings, Error logs, in-built analytics.