Install and configure OpenCart e-commerce platform on Ubuntu 20.04

To
You can download this article in PDF format via the link below to support us.

Download the guide in PDF format

turn off
To

To
To

For merchants, having an online ordering platform has never been more important than no cash. For a company to completely change the way it deals with customers and conduct business in a completely different online virtual store, it can be expected that most business people will be confused, nervous, challenging and completely difficult under certain circumstances . .

Thanks to this brilliant and amazing open source community, which is constantly changing people’s lives and making great contributions to the entire planet, companies, start-ups and SMEs can use simple solutions to completely change the way they do business. One such excellent solution is OpenCart.

Opencart is an easy-to-use, powerful open source online store management program, just fill in the form and click “save”. There are many professionally written extensions that can be used to customize the store according to your needs. Resources: About OpenCart.

Features of OpenCart

  • Administrator dashboard: all important information is clear at a glance.
  • User management: OpenCart allows you to set advanced user privileges and have individual access to user groups and users.
  • Multi-store: Manage multiple stores from one management interface.
  • Options, attributes: In either case, OpenCart provides solutions for adding additional important product variables.

Install OpenCart on Ubuntu 20.04

In order to set up Open Cart, your server needs to meet some minimum requirements so that it can be installed and functioning properly. They include:

  • Network Server
  • PHP (at least 5.4)
  • Enable curl
  • Database (MySQLi is recommended)

Now that we know what we need, let’s proceed to install OpenCart:

Step 1: Update and install basic tools

After entering the terminal of the new Ubuntu server, update it and install the basic tools that will be used during the installation process

sudo apt update && sudo apt upgrade
sudo apt install vim git unzip curl -y

Step 2: Install and set up the database

We will use MariaDB for this setup. Fortunately, we already have a detailed guide to install MariaDB 10.5. Check out how to install MariaDB on Ubuntu 20.04 (Focal Fossa)

After installing the database, the next step is to create a database and user for OpenCart. Proceed as shown in the figure below. Please note that you are free to use different names for the database and users, and make sure to use secure passwords.

$ mysql -u root -p
Enter password: 

MariaDB [(none)]> CREATE DATABASE opencartdb;
MariaDB [(none)]> CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'StrongPassword';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON opencartdb . * TO 'opencartuser'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Step 3: Install and configure the web server and PHP

In order to obtain OpenCart services, a web server must exist. Here, you can choose Apache or Nginx. We will use Nginx in this guide. In addition, OPenCart requires PHP, so we must also set it up. We have a complete guide covering the installation of Nginx and PHP-FPM on Ubuntu 20.04. Please follow it and proceed to the next step.

Add recommended PHP settings

Open your php-fpm ini file and add/edit the details shown below. They include time zone and memory limit settings. Add your date.timezone (about line 955) and change the memory_limit (about line 400) to 512MB.

$ sudo vim /etc/php/7.4/fpm/php.ini

memory_limit = 512M

[Date]
date.timezone = Africa/Nairobi

Check if php-fpm is running.

$ sudo systemctl status php7.4-fpm

● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2020-08-05 20:20:57 UTC; 2min 13s ago
       Docs: man:php-fpm7.4(8)
    Process: 20536 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (>
   Main PID: 20518 (php-fpm7.4)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 2319)
     Memory: 9.3M
     CGroup: /system.slice/php7.4-fpm.service
             ├─20518 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
             ├─20534 php-fpm: pool www
             └─20535 php-fpm: pool www

Step 4: Clone OpenCart files from git and configure Nginx

The root directory is the folder where our web server will check out OpenCart files and provide these files on request. You can create a different object as needed.

sudo mkdir /var/www/html/commerce/ && cd /var/www/html/commerce/
sudo git clone https://github.com/opencart/opencart.git

A new directory called opencart will be created inside /var/www/html/commerce and the files will be copied from OpenCart’s GitHub repository into that directory.

After cloning the file, navigate to the upload and upload/management directory and rename config-dist.php to config.php and admin/config-dist.php to admin/config.php

$ cd /var/www/html/commerce/opencart/upload/
$ sudo mv config-dist.php config.php

##Then..

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

Configure Nginx

We have to make some changes to the Nginx configuration defaults by adding the details required to service OPenCart. Change to enable the site, back up the default file and create a new file with the new configuration.

cd /etc/nginx/sites-enabled/
sudo mv default /tmp

Create a new file and add the details as shown below. If you have an FQDN, replace it with example.com.

$ sudo vim /etc/nginx/sites-enabled/opencart.conf

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  example.com;
        root         /var/www/html/commerce/opencart/upload;
        index index.php index.htm index.html;

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ .php$ {
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_read_timeout 240;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        }
}

Change OpenCart file permissions

In order for Nginx to read the file, we must grant it the correct permissions. Issue the following command to complete the operation, then restart Nginx and php-fpm.

sudo chown -R www-data:www-data /var/www/html/commerce/
sudo chmod -R 755 /var/www/html/commerce/
sudo systemctl restart nginx php7.4-fpm

Step 5: Complete OpenCart settings through the web interface

To complete the settings of OpenCart, point your browser to the IP or domain name of the web server that provides the file.[[[[http: //[ip-or-domain-name]. You should get the following page

agreement

It starts with the license agreement, you should accept the license agreement before proceeding to the next step. Please click”carry on“On the previous page

Pre-installed

On the next page, check whether the server settings are correct. Make sure that the “Current Settings” on each table matches the “Required Settings”. In addition, please make sure that the files /var/www/html/commerce/opencart/upload/config.php and /var/www/html/commerce/opencart/upload/admin/config.php are writable. After confirming that everything is ok, scroll down and click “carry on

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

Enter your database and management details

On the next page displayed, you will be provided with a form for you to fill in the database details we created in it Step 2. You will notice a section asking for your administrator credentials. Fill in your preferred username and password. After filling in correctly, just click “carry on“At the bottom of the page.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

The installation is complete

If all goes well, you should see the message “Don’t forget to delete the installation directory!” You can continue to delete the directory. Our setup is finally complete! ! Click “Log in to your admin“Started to customize the backend of our first website.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

Step 6: Getting started with OpenCart on Ubuntu 20.04

After installing OpenCart, there are many steps you need to perform to start selling from your online store. The OpenCart store consists of a front end and a management interface. This step will mainly focus on the management interface functions and settings. Before launching the website, these settings should be tested on the front end. We already have administrator login credentials and can log in to the store management interface in the following ways http: // server-ip-or-domain-name / admin Redirect from the previous step.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

After logging in, you may be asked to move the storage directory out of the public folder. Just click “mobile“, you will be sorted. After that, the dashboard should appear.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

General settings

Down System>Settings, You need to set the store’s name, owner, address, email and phone number. Click the “Edit” icon to start editing these settings. When you are done, click the save icon to keep your settings.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

Store settings

Under “Store Settings”, we will change the default settings such as “Your Store” to our actual store name and a description of the search engine. When finished, click the save icon to keep these settings.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

Local configuration

The local settings allow you to choose the country in which the store operates. When finished, click the save icon to keep the settings.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

Image settings

Next, you need to choose a logo for your store, and then upload the logo via the “Image Settings” tab.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

To fully customize your website, follow the instructions on the other tabs (images, mail, server), just like on the other tabs.

To view your custom website, just point your browser to http: // server-ip-or-domain-name URL.

Install and configure OpenCart e-commerce platform on Ubuntu 20.04

Concluding remarks

There are many things you can do to make your online store better. You can integrate it with available payment gateways, change its look and feel through modules and themes, inventory management, tax options by default, etc. Quickly and acutely view its Official documents Will attract people to have a better understanding of this amazing e-commerce platform.

To
You can download this article in PDF format via the link below to support us.

Download the guide in PDF format

turn off
To

To
To

Sidebar