ManagedCloud Servers

High performance handled and monitored by us 24/7/365. A complete solution to provide you with our in house expertise 24/7 tailored to your specific needs. We'll setup a bespoke server for your site using the latest tehnologies so you can get the most out of your hardware and get your website loading quickly and reliably. Find out more..

cPanelCloud Servers

Recommended - High performance cloud servers with no technical knowledge required. If you're hosting multiple websites already and you're looking to consolidate, or if you're looking to isolate yourself from the shared hosting environment but you don't have the time or knoweldge to manage a server, then the Managed cPanel Servers are for you. Find out more..

UnmanagedCloud Servers

Our unmanaged range gives you complete control at rock bottom prices and our cloud platform boasts super fast multipath 40Gb/s network, the latest Intel Xeon V3 CPUs and enterprise grade redundant SSDs. If you're a sysadmin look no further, we offer some of the best specification to price ratio servers available. Find out more..

Want your very own server? Get our 1GB memory, Xeon V4, 20GB SSD VPS for £10.00 / month.

View Plans

How to Install OpenCart on Ubuntu 16.04

OpenCart is a free open source e-commerce software for a better shopping cart solution. It is written in PHP and uses MySQL to store data.

It is one of the most popular eCommerce software suitable for a small and medium online businesses. You can easily manage orders, products and categories using OpenCart. OpenCart provides thousands of themes and plugins and supports multi-currency.

In this tutorial, we will learn how to install OpenCart on Ubuntu 16.04 server.

Requirements

  • A server running Ubuntu 16.04.
  • A normal user with sudo privileges setup on your server.

Update the System

Before installing any packages, it is recommended to update your system with the latest stable version. You can do this with the following command:

sudo apt-get update -y sudo apt-get upgrade -y

Once your system is up to date, you can proceed to install the Apache web server.

Install Apache Web Server

First, you will need to install the Apache web server on your system. You can easily install it by running the following command:

sudo apt-get install apache2 -y

Once apache is installed, start the Apache web server and enable it to start on boot with the following command:

sudo systemctl start apache2 sudo systemctl enable apache2

Install PHP

You can install PHP and other required modules with the following command:

sudo apt-get install wget unzip php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0 php7.0-mcrypt

Once all the packages are installed, you will need to make some changes in php.ini file:

sudo nano /etc/php/7.0/cli/php.ini

Change the following lines:

date.timezone = Asia/Kolkata
post_max_size = 32M
upload_max_filesize = 32M

Save and close the file when you are finished, then restart Apache web server to make this changes take effect:

sudo systemctl restart apache2

Once you are done, you can proceed to install MariaDB server.

Install and Configure MariaDb Server

You will need to install MariaDB server to store data. You can install it with the following command:

sudo apt-get install mariadb-server -y

Start MariaDB and enable it to automatically start at boot time.

sudo systemctl start mysql sudo systemctl enable mysql

By default, MariaDB is not secured, so you will need to secure it first. You can secure it by running the mysql_secure_installation script.

sudo mysql_secure_installation

Answer all the questions as shown below:

Set root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Once MariaDB is secured, log in to the MySQL shell and create a database for opencart: mysql -u root -p

Enter your root password when prompted, then create a database for OpenCart. It is recommended to set a secure password:

MariaDB [(none)]>CREATE DATABASE opencart_db;
Query OK, 1 row affected (0.00 sec)

Next, create a username and password for opencart with the following command:

MariaDB [(none)]>CREATE USER 'opencart'@'localhost' IDENTIFIED BY 'password';
Query OK, 1 row affected (0.00 sec)

Next, grant privileges to the OpenCart database with the following command:

MariaDB [(none)]>GRANT ALL PRIVILEGES ON opencartdb.* TO 'opencart'@'localhost';
Query OK, 1 row affected (0.00 sec)

Next, you will need to run the FLUSH PRIVILEGES command so that the privileges table will be reloaded by MariaDB and we can use new credential:

MariaDB [(none)]>FLUSH PRIVILEGES;
Query OK, 1 row affected (0.00 sec)

Next, exit from the MariaDB console with the following command:

MariaDB [(none)]>\q

Once you are done, you can proceed to the next step.

Install opencart

You can download the latest stable version of the opencart from the GitHub repository. To download it, run the following command:

wget https://github.com/opencart/opencart/archive/master.zip

Once the download is completed extract the downloaded file with the following command:

unzip master.zip

Next, move the extracted archieve to the apache web root directory:

sudo mv opencart-master/upload /var/www/html/opencart

Next, you will need to change permissions of the opencart folder:

sudo chown -R www-data:www-data /var/www/html/opencart sudo chmod -R 777 /var/www/html/opencart

Next, change the directory to opencart and rename the configuration files:

cd /var/www/html/opencart mv sudo config-dist.php config.php mv sudo admin/config-dist.php admin/config.php

Configure Apache Web Server for Opencart

You will need to create a virtual host file for OpenCart. You can do this by creating opencart.conf file inside /etc/apache2/sites-available/ directory:

`sudo nano /etc/apache2/sites-available/opencart.conf

Add the following lines:

<VirtualHost *:80>
    ServerAdmin admin@yourdomain.com
    DocumentRoot "/var/www/html/opencart/"
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    <Directory "/var/www/html/opencart">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
    ErrorLog "/var/log/apache2/opencart-error_log"
    CustomLog "/var/log/apache2/opencart-access_log" combined
</VirtualHost>

Save and close the file when you are finished, then enable the site with the following command:

sudo a2ensite opencart.conf

Finaly, restart Apache web server so that the changes take place:

sudo systemctl restart apache2

Once you are finished, you can proceed to access opencart web installation wizard.

Access Opencart

Before accessing the OpenCart Web Interface, you will need to allow HTTP service through UFW firewall.

By default UFW is disabled on your system, so you need to enable it first. You can enable it with the following command:

sudo ufw enable

Once UFW firewall is enabled, you can allow HTTP service by running the following command:

sudo ufw allow http

You can now check the status of UFW firewall by running the following command:

sudo ufw status

Next, Open your web browser and type the URL http://yourdomain.com, you should see the following page:

Here, accept the License agreement and click on Continue button, you should see the following page.

Here, the installer will check if your system meets all the requirements to install OpenCart. Once all the requirements satisfied. Click on Continue button, you should see the following page.

Here, provide all the required details like, database name, Username, Password, Admin Username and Password, then click on Continue button. Once the installation is completed, you should see the following page:

Here, click on LOGIN TO ADMINISTRATION button. You should see the OpenCart login page in following image:

Provide your login credentials and click on Login button, you should see the OpenCart Dashboard as below:

Note: After installing OpenCart don't forget to to delete the install folder.

Conclusion

Congratulations! You have successfully installed OpenCarton Ubuntu 16.04 server. You can now easily create your own online store using OpenCart.

Want your very own server? Get our 1GB memory, Xeon V4, 20GB SSD VPS for £10.00 / month.

View Plans

Comments

  • Joker

    hi, i did all the step by the GD extension is off, what i need to do ?

  • TosiOn

    Thanks! Got the installation done lightning fast with this guide. Just one minor typo
    GRANT ALL PRIVILEGES ON opencartdb.* TO ‘opencart’@’localhost’;
    should be
    GRANT ALL PRIVILEGES ON opencart_db.* TO ‘opencart’@’localhost’;