How to Install OpenCart on Ubuntu 16.04

By Hitesh Jethva, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

OpenCart is a free, open source, popular and widely used php-based online shopping cart software solution that can be used to setup and run your own online store at a minimal cost. It is specially disigned for small and medium-size businesses. It is simple, easy to install and comes with many add-ons, extensions that enable you to create your own online business and participate in e-commerce at a minimal cost. You can easily manage multiple stores from web-based interface, set products to appear on different stores and choose a different theme for each store.

Alibaba Cloud provides a ready-to-use OpenCart server in the Marketplace, but you can also install your own on for more customization. In this tutorial, we will be installing and configuring OpenCart on an Alibaba Cloud Elastic Compute Service (ECS) Ubuntu 16.04 server.

Requirements

  • A fresh Alibaba Cloud Ubuntu 16.04 instance.
  • A static IP address is set up in your instance.
  • A root password is set up to your instance.

Launch Alibaba Cloud ECS Instance

First, Login to your Alibaba Cloud ECS Console. Create a new ECS instance, choosing Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

Install LAMP Server

OpenCart runs on web server, writen in PHP and uses MariaDB to store their data. So you will need to install Apache, MariaDB, PHP and Other PHP libraries to your server. You can install all of them by running the following command:

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

Make the following changes:

Save and close the file, when you are finished.

Configure MariaDB

Next, you will need to harden MariaDB installation. You can do this by running the following script:

This script will set the root password, remove anonymous users, disallow root login and remove test database as shown below:

Once the MariaDB is secured, login to MariaDB shell:

Enter your root password, then create a database and user for OpenCart:

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

Next, flush the privileges and exit from the MariaDB shell with the following command:

Install OpenCart

First, you will need to download the latest version of OpenCart from Git repository. You can download it with the following command:

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

Next, copy the upload directory to the Apache web root directory and give proper permissions with the following command:

Next, copy sample config file with the following command:

Configure Apache for OpenCart

Next, you will need to create an Apache virtual host file for OpenCart. You can do this with the following command:

Add the following lines:

Save and close the file. Then, enable Apache virtual host with the following command:

Next, enable an Apache rewrite module and reload Apache service with the following command:

Access OpenCart Web Interface

Now, open your web browser and type the URL http://example.com. You will be redirected to the OpenCart license agreement as shown below:

Accept the license agreement and Click on the CONTINUE button. You should see the pre-installation check page:

Make sure all the required packages are installed. Then, click on the CONTINUE button. You should see the following page:

Here, provide your database name, database username, password, admin username and password. Then, click on the CONTINUE button. Once the installation has been completed, you should see the following page:

Now, click on LOGIN TO YOUR ADMINISTRATION button. You will be redirected to the OpenCart login page:

Now, provide your admin username and password. Then, click on the Login button. You should see the OpenCart default dashboard in the following image:

You can also access your online store by visiting the URL http://example.com. You should see the following page:

Next, you will need to delete the installation directory on the server.

Congratulations! You have successfully installed and configured OpenCart on Ubuntu 16.04 server. You can now easily deploy your own online store using OpenCart.

Original Source

https://www.alibabacloud.com/blog/how-to-install-opencart-on-ubuntu-16-04_594939?spm=a2c41.13062098.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store