How to install Opencart on Ubuntu 18.04

To install Opencart on Ubuntu 18.04

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.

Prerequisites

To install LAMP(Apache, MariaDB, php7)

In MariaDB (create database and user and give privileges to that user )

Php installation with required following modules

add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.0 php7.0-mysql php7.0-curl php7.0-json php7.0-cgi libapache2-mod-php7.0 php7.0-mcrypt php7.0-xmlrpc php7.0-gd php7.0-mbstring php7.0  php7.0-common  php7.0-xmlrpc php7.0-soap  php7.0-xml php7.0-intl 
php7.0-cli  php7.0-ldap php7.0-zip php7.0-readline php7.0-imap php7.0-tidy php7.0-recode php7.0-sq php7.0-intl

Download an Opencart package from the terminal using wget command

root@linuxhelp1:~# wget https://github.com/opencart/opencart/releases/download/3.0.2.0/3.0.2.0-OpenCart.zip
--2018-06-12 01:14:40--  https://github.com/opencart/opencart/releases/download/3.0.2.0/3.0.2.0-OpenCart.zip
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
.
.
HTTP request sent, awaiting response... 200 OK
Length: 16544198 (16M) [application/octet-stream]
Saving to: ‘ 3.0.2.0-OpenCart.zip’ 

3.0.2.0-OpenCart.zip    100%[==============================> ]  15.78M   736KB/s    in 50s    

2018-06-12 01:15:33 (325 KB/s) - ‘ 3.0.2.0-OpenCart.zip’  saved [16544198/16544198]

The download package is a zip file, so unzip the package as follows

root@linuxhelp1:~# unzip 3.0.2.0-OpenCart.zip -d opencart
Archive:  3.0.2.0-OpenCart.zip
  inflating: opencart/build.xml     
  inflating: opencart/CHANGELOG.md  
  inflating: opencart/CHANGELOG_AUTO.md 
  inflating: opencart/composer.json 
  inflating: opencart/composer.lock
.
.
  inflating: opencart/upload/system/storage/vendor/zoujingli/wechat-php-sdk/Wechat/WechatReceive.php 
  inflating: opencart/upload/system/storage/vendor/zoujingli/wechat-php-sdk/Wechat/WechatScript.php 
  inflating: opencart/upload/system/storage/vendor/zoujingli/wechat-php-sdk/Wechat/WechatService.php 
  inflating: opencart/upload/system/storage/vendor/zoujingli/wechat-php-sdk/Wechat/WechatUser.php

Move the extracted file into the HTML location

root@linuxhelp1:~# mv opencart /var/www/

switch to the following directory

root@linuxhelp1:~# cd /var/www/

Change the ownership and permission of the file as follows

root@linuxhelp1:/var/www# chown -R www-data.www-data opencart
root@linuxhelp1:/var/www# chmod -R 775 opencart

Create a new virtual host configuration for accessing the Opencart

root@linuxhelp1:/var/www# vim /etc/apache2/sites-available/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> 

Enable the site access

root@linuxhelp1:/var/www# a2ensite opencart.conf
Enabling site opencart.
To activate the new configuration, you need to run:
 systemctl reload apache2

Disable the default site access

root@linuxhelp1:/var/www# a2dissite 000-default.conf
Site 000-default disabled.
To activate the new configuration, you need to run:
 systemctl reload apache2

Enable the rewrite module

root@linuxhelp1:/var/www# a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
 systemctl restart apache2

Restart the apache2 service

root@linuxhelp1:/var/www# systemctl restart apache2

Now you can proceed the further installation and configuration from the browser by navigating to the following URL of http://local IP (or) domain name

Accept the License agreement to use the Opencart

Check out the preinstallation requirements

Now make changes as follows

root@linuxhelp1:/var/www# cd opencart/upload/

Rename the filename

root@linuxhelp1:/var/www/opencart/upload# mv config-dist.php config.php

Switch into the following directory

root@linuxhelp1:/var/www/opencart/upload# cd admin/

Rename the filename

root@linuxhelp1:/var/www/opencart/upload/admin# mv config-dist.php config.php

Restart the apache2 service

root@linuxhelp1:/var/www/opencart/upload/admin# systemctl restart apache2

After making the changes, you can proceed with the installation

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 admin dashboard of Opencart

You can choose the Admin user profile and click on your store option, and it will redirect to your site of Opencart store

with this, the method to install Opencart on Ubuntu 18.04 comes to an end.

Tag : OpenCart
FAQ
Q
What are the requirements for Opencart?
A
The requirements for Opencart are as follows,
Install LAMP(Apache, MariaDB, php7)
Configure Apache
In MariaDB (create database and user and give privileges to that user )
Install PHP 7 with following modules
(php7.0-mysql php7.0-curl php7.0-json php7.0-cgi libapache2-mod-php7.0 php7.0-mcrypt php7.0-xmlrpc php7.0-gd php7.0-mbstring php7.0 php7.0-common php7.0-xmlrpc php7.0-soap php7.0-xml php7.0-intl
php7.0-cli php7.0-ldap php7.0-zip php7.0-readline php7.0-imap php7.0-tidy php7.0-recode php7.0-sq php7.0-intl)
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
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
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
Is there any alternative for the Opencart software?
A
The following are the alternatives for Opencart software,
PrestaShop
WooCommerce
Shopify