Ubuntu/centos Guide to Install OpenCart

Source: Internet
Author: User
Tags mcrypt pear opencart

OpenCart is a free and open source web based ECommerce online store management system for a better shopping cart solution. It is a foundation for building an online store allowing the shop owners to make business to their products or shop with The power of the Internet. It has a beautiful user interface making it pretty handy to anyone the who is running their online store Withopencart. It has pretty bunches of awesome features and is highly extensible. It's one of the most popular ECommerce software off there in the Internet. OpenCart features unlimited categories, products, manufacturers, multi currency, language, product reviews, ratings, Autom Atic image Resize and more than 20+ payment gateways with 8+ shipping methods. There is pretty cool free documentation written by the OpenCart community with both free and commercial technical support .

In this article, we'll learn how to setup OpenCart on our machine running Ubuntu and CentOS as operating system.

Installing LAMP Stack

OpenCart needs a webserver running to being available to the public via web browser, a database server to store it data and As its a PHP application, we'll surely require PHP modules to do it work. So, to fulfill all those needs, LAMP stacks are the best stacks to make everything working in place. LAMP Stack is the collection of Apache Web server, mysql/mariadb databse server and PHP5 with required PHP modules. To install LAMP Stack, we'll need to run the following commands with respect to the distribution of Linux we is running O n Our machine.

Centos

First of all, we'll need to update our system ' s packages which would fetch the repository index from its mirrors.

# Yum Update

Once done, we'll need to the add EPEL Repository to our CentOS machine so the We can install all those modules and packages n Ecessary to setup OpenCart and then go ahead on the installation of those packages.

# yum Install Epel-release
# yum Install httpd mariadb-server php php-mysql php-pear php-gd php-xml php-curl php-mbstring php-mcrypt zlib-devel Unzip

Ubuntu

# Apt-get Update
# apt-get Install apache2 mariadb-server mariadb-client php5-mysql php-pear php5-gd libapache2-mod-php5 php5-curl php5-de V Php5-mcrypt Zlib1g-dev Unzip

Configuring MariaDB Server

As its our first time we had installed Mariadb,we ' ll need to configure a root password for our MariaDB server. To configure MariaDB, we'll first need to restart our MariaDB servers by running the following command.

On SYSTEMD

If we ' re running a distribution of Linux like CentOS 7, Ubuntu 15.04/15.10 shipped with SYSTEMD as an init system, we ' ll N Eed to run the following SYSTEMCTL command to restart MariaDB.

On CentOS

# systemctl Restart MARIADB

On Ubuntu

# systemctl Restart MySQL

On Sysvinit

But if we ' re running a distribution of Linux like Ubuntu 14.04, we'll need to run the following service command to restart It.

# service MySQL Restart

After it is done, we'll configure our MariaDB and assign a root password. To does so, we'll need to run the following command.

# mysql_secure_installation

This would ask us to enter the password for root but as we haven ' t set Any password before and their our first time we ' ve installed MARIADB, we'll simply press ENTER and go further. Then, we'll be asked to set root password, here we'll hit Y and enter our password for root of MariaDB. Then, we'll simply hit enter into set the default values for the further configurations.
....
so should just press ENTER here.
Enter current password to 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 authorisation.< Br>set root Password? [y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables.
... success!
...
installation should now is secure.
Thanks for using mariadb!

Note:please Note that, we'll need the above entered root password later inorder to create a new database for our OpenCart Installation.

Creating a MariaDB Database

Next, we ll login to the MariaDB command prompt as root. Here, we'll need to enter the password of the MariaDB root account that we had set above.

# mysql-u Root-p

After we ' re logged on into the mariadb command prompt, we'll gonna create the database.

> CREATE DATABASE opencartdb;
> CREATE USER ' opencartuser ' @ ' localhost ' identified by ' pa$ $worD ';
> GRANT All privileges the opencartdb.* to ' opencartuser ' @ ' localhost ';
> FLUSH privileges;
> EXIT;

Finally, we ' ve successfully created a database named opencartdb with usernameopencartuser and password a s pa$ $worD .

Note: It is strongly recommended to replace the above variables as your desire for the security issue and please note them down Somewhere so, we can use those details later while installing OpenCart.

Downloading OpenCart

Now, we'll go for downloading the latest release (during the time of writing this article) of OpenCart IE version 2.1.0.2. We can download the latest release from theofficial download page but as we ' re gonna download it via console or terminal, We ' ll simply get the link from the site and download it using the following wget command.

# cd/tmp
# wget Https://codeload.github.com/opencart/opencart/zip/2.1.0.2-O Opencart.2.1.0.2.zip

--2016-02-16 17:10:30--https://codeload.github.com/opencart/opencart/zip/2.1.0.2
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 ... OK
length:12090195 (12M) [Application/zip]
Saving to: ' Opencart.2.1.0.2.zip '
100%[===========================================>] 12,090,195 2.39mb/s in 5.3s
2016-02-16 17:10:37 (2.18 MB/s)-' opencart.2.1.0.2.zip ' saved [12090195/12090195]

Once The download is completed, we'll simply extract the compressed zip file by running the following unzip command.

# Unzip Opencart.2.1.0.2.zip

We ' ll then move the extracted files and directories to/var/www/opencart/directory where we'll store our OpenCart website Files and make it as the Webroot for our domain using Apache Web server.

# mkdir-p/var/www/opencart
# mv/tmp/opencart-2.1.0.2/upload//var/www/opencart/

Configuring Apache Web Server

Next, we'll create a new Apache configuration file named Opencart.conf under/etc/httpd/conf.d/directory using a text EDI Tor. To does so, we'll need to execute the following command in a terminal or console.

On CentOS

# nano/etc/httpd/conf.d/opencart.conf

Then, we'll gonna add the following lines of the configuration into the file.

<virtualhost *:80>
ServerAdmin [email protected]
Documentroot/var/www/opencart/upload
ServerName opencart.linoxide.com
Serveralias www.opencart.linoxide.com
<Directory/var/www/opencart/upload>
Options FollowSymLinks
AllowOverride All
</Directory>
Errorlog/var/log/httpd/opencart.linoxide.com-error_log
Customlog/var/log/httpd/opencart.linoxide.com-access_log Common
</VirtualHost>

Once done, we'll need to simply save the file and exit the text editor.

On Ubuntu

# touch/etc/apache2/sites-available/opencart.conf
# ln-s/etc/apache2/sites-available/opencart.conf/etc/apache2/sites-enabled/opencart.conf
# nano/etc/apache2/sites-available/opencart.conf

Now, we'll gonna add the following lines of the configuration into the opened file.

<virtualhost *:80>
ServerAdmin [email protected]
Documentroot/var/www/opencart/upload
ServerName opencart.linoxide.com
Serveralias www.opencart.linoxide.com
<Directory/var/www/opencart/upload>
Options FollowSymLinks
AllowOverride All
</Directory>
Errorlog/var/log/apache2/opencart.linoxide.com-error_log
Customlog/var/log/apache2/opencart.linoxide.com-access_log Common
</VirtualHost>

After-done, we ll gonna save the file and exit the text editor. Then, we'll need to make sure this mod is enabled. To enable it, we'll need to execute the following command.

# A2enmod Rewrite

Fixing Ownership

Our version of OpenCart requires us to create a configuration file for it. To doing so, we can simply rename the existing config-dist.php files to config.php located under the OpenCart ' s directory. We can execute the following command to rename config-dist.php files to config.php in the respective directories.

# Cd/var/www/opencart/upload
# MV Config-dist.php config.php
# MV Admin/config-dist.php admin/config.php

We ' ll now need to the ownership of the directory where we opencart files is extracted to Apache user so that APAC The He process owner can has full read/write access through that directory.

On CentOS

# Chown-r Apache:/var/www/opencart/upload

On Ubuntu

# chown-r Www-data:/var/www/opencart/upload

Restarting and enabling Services

Once all the configuration and setup are done, we'll need to restart our Apache Web server and mariadb and make it able to Start automatically in every boot of the system. To does so, we'll need to execute the following commands with respect to the distribution we is running.

On CentOS

# systemctl Restart httpd mariadb
# Systemctl Enable httpd mariadb

On Ubuntu 15.04/15.10

# systemctl Restart apache2 mysql
# systemctl Enable apache2 MySQL

On Ubuntu 14.04

# Service Apache2 Restart
# service MySQL Restart
# UPDATE-RC.D Apache2 Enable
# UPDATE-RC.D MySQL Enable

Allowing Firewall

In order to expose our OpenCart online store on the Internet or inside the same network, we'll need to make Port open F Rom the firewall program. To allow port or HTTP service, we'll need to run the following commands according to the firewall program installed and Running in our system.

On FIREWALLD

As Linux distributions like Ubuntu 15.04/15.10, CentOS 7 is shipped with SYSTEMD, FIREWALLD is popular firewall programs installed. So, we'll need to run the following Firewall-cmd commands to open HTTP services.

# Firewall-cmd--permanent--add-service=http

Success

# Firewall-cmd--reload

Success

On Iptables

Distributions like Ubuntu 14.04 is shipped with Sysvinit as init system so, iptables is used as firewall program so, we ' ll need to open port running the following.

# iptables-i input-p TCP--dport 80-j ACCEPT
# sh-c "Iptables-save >/etc/iptables.rules"

WEB Installation

Finally after everything is set as expected above, we'll now go for the OpenCart web based installation process. To does so, first we'll need to point our web browser to our server's IP address or domain name as http://ip-address/or htt P://domain.com/according to our configuration. Here, in this tutorial, we'll point our web browser to Http://opencart.linoxide.com/and start the installation process as Shown below.

To continue the installation further, we'll click on continue button as shown in the above image. This would load another page of installation where every pre-installation configurations is checked. As we have the fulfilled every requirements to run OpenCart, we'll see every status in green color as shown below.

Next, we'll click on Continue to move ahead towards the Configuration page. Here, we'll need to enter the requireddatabase login Credentials We had set above while creating the database for Our OpenCart installation. Then, we'll set an username, password and email which we'll require further to login into the admin panel.

Once done, we'll go further to complete the installation. Then, we'll be welcomed by ainstallation complete page as shown below where we'll be asked whether to go to the S Tore page or to the Administration panel.

Now, to goto our Online Store, we can point our browser to our domain or the path where we had installed it ie. http://opencart.linoxide.com/ . Then, we'll see the first screens of our store powered by OpenCart.

In order to login to the Administration panel, we'll need to point our browser to admin path ie. http://opencart.linoxide.com/admin . Then, we'll need to enter the login details of the panel which we had set above.

Issue with Ubuntu

If you encountered missing extension under MCrypt sections while performing the OpenCart pre-installation check, we ' ll need To run the following command to fix it.

# Php5enmod MCrypt

Then, we'll need to restart the webserver by running the following command.

# Service Apache2 Restart

Once done, we'll need to continue the web based installation as shown above.

Post-Installation

Finally, as the installation process is complete, we'll now need to remove the install directory as per the security Reaso Ns. In order to completely remove the directory, we'll need to run the following command.

# rm-rf/var/www/opencart/upload/install/

Installing Vqmod

Vqmod for OpenCart lets us to add extension modules to our store without modifying the core OpenCart code. To install Vqmod in our OpenCart, we'll need to download the latest release of Vqmod built for OpenCart from Itsofficial G Ithub Repository. To does so, we'll simply run the following wget command to download the latest compressed zip file of vqmod IE version 2.5.1 Using its link.

# cd/tmp/
# wget Https://github.com/vqmod/vqmod/releases/download/v2.5.1-opencart.zip/vqmod-2.5.1-opencart.zip

Then, we'll simply extract the file and move to the root of our OpenCart installation.

# Unzip Vqmod-2.5.1-opencart.zip
# mv/tmp/vqmod/var/www/opencart/upload/

As Vqmod recommends index.php and admin/index.php to be writable, we'll need to set their file permission to 755.

# Cd/var/www/opencart/upload
# chmod 755 index.php admin/index.php

Once done, we'll need to install it by pointing our browser to the install directory of vqmod ie Http://opencart.linoxide. Com/vqmod/install/in this tutorial. Unlike, the install directory of OpenCart, we shouldn ' t delete the install directory of Vqmod.

Conclusion

We had successfully installed the latest release of OpenCart in our machine running Ubuntu and CentOS distributions of GNU /linux. There is both free/community support as well as commercial support by OpenCart. It ' Sdocumentation site contains one of the best documentation available for an online store software. It is pretty easy and simple to setup OpenCart. We don ' t require much technical knowledge to setup it with the basic configuration by following this tutorial. We have covered installation for Ubuntu 15.04/15.10 and CentOS 7 in this tutorial. If you had any questions, suggestions, feedback-write them in the comment box below so, we can improve or UPDA Te our contents. Thank you! Enjoy:-)

Ubuntu/centos Guide to Install OpenCart

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.