Installing CubeCart on Ubuntu 20.04

Updated on March 1, 2022
Installing CubeCart on Ubuntu 20.04 header image

Introduction

CubeCart is an open-source eCommerce cart software used for creating online stores for business transactions. It's based on PHP, making it easy to set up and run. Some important features are:

  • Technical support offered.
  • Detailed statistics on products.
  • Social media plugins.
  • Multi-lingual support.
  • Multi-currency support.
  • Database management tools for backups and restore.
  • Offline mode with cache support.

This article explains how to install CubeCart on Ubuntu 20.04 server.

Prerequisites

1. Install LAMP Server

Update system package list.

$ sudo apt update

Add ppa:ondrej/php PPA repository.

$ sudo apt -y install software-properties-common

$ sudo add-apt-repository ppa:ondrej/php

Update system package manager.

$ sudo apt update

PHP version 7.3 is recommended for CubeCart. Install PHP 7.3, Apache, MariaDB, and more modules.

$ sudo apt install apache2 mariadb-server mariadb-client php7.3 libapache2-mod-php7.3 php7.3-json php7.3-common php7.3-gmp php7.3-curl php7.3-mysql php7.3-mysqli php7.3-mcrypt php7.3-opcache php7.3-intl php7.3-fpm php7.3-xmlrpc php7.3-bcmath php7.3-zip php7.3-imagick php7.3-mbstring php7.3-gd php7.3-cli php7.3-xml php7.3-zip wget unzip curl -y

Edit the PHP configuration file.

$ sudo nano /etc/php/7.3/apache2/php.ini

To search for a specific line, use Control + W, enter search phrase then press Enter.

memory_limit = 512M
upload_max_filesize = 100M
post_max_size = 100M

Enable the web server to start automatically on a reboot.

$ sudo systemctl enable apache2

Restart web server for changes to take effect.

$ sudo systemctl restart apache2

2. Create Database for CubeCart

Enable the database server to start automatically on a reboot.

$ sudo systemctl enable mariadb

Run mysql_secure installation script to secure MariaDB database server from security breaches.

$ sudo mysql_secure_installation

When prompted, answer the questions as shown below:

  • Enter current password for root. Press Enter.
  • Set root password? Press Y, then Enter.
  • Remove anonymous users? Press Y, then Enter.
  • Disallow root login remotely? Press Y, then Enter.
  • Remove test database and access to it? Press Y, then Enter.
  • Reload privilege tables now? Press Y, then Enter.

Log in to MySQL shell. At the password prompt, enter your password to continue.

$ sudo mysql -u root -p

Create a MySQL database named cubecart.

CREATE DATABASE cubecart;

Create a database user named cubecartuser with a password. Change the value of StrongPassword with your own secure password.

CREATE USER 'cubecartuser'@'localhost' IDENTIFIED BY 'StrongPassword';

Grant the user full access to the database.

GRANT ALL ON cubecart.* TO 'cubecartuser'@'localhost' WITH GRANT OPTION;

Save the changes.

FLUSH PRIVILEGES;

Exit the shell.

EXIT

3. Install CubeCart

Download the latest version of CubeCart. To find the latest version of the installation files, please visit files repository.

$ wget https://www.cubecart.com/download/CubeCart-6.4.4.zip

Create the application installation directory /var/www/cubecart on the web root.

$ sudo mkdir -p /var/www/cubecart

Extract the downloaded installation files to the installation directory.

$ sudo unzip CubeCart-6.4.4.zip -d /var/www/cubecart

Delete the downloaded files.

$ sudo rm CubeCart-6.4.4.zip

Change ownership of the installation directory.

$ sudo chown -R www-data:www-data /var/www/cubecart

Change access permissions for the directory.

$ sudo chmod -R 755 /var/www/cubecart

4. Configure Apache2

Allow port 80 through the firewall.

$ sudo ufw allow 80

Create a new Apache configuration file cubecart.conf.

$ sudo nano /etc/apache2/sites-available/cubecart.conf

Add the following content below into the file. Save and close the file:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/cubecart
    ServerName example.com
    ServerAlias www.example.com

     <Directory /var/www/cubecart/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Disable Apache default configuration file.

$ sudo a2dissite 000-default.conf

Enable the CubeCart Apache configuration file.

$ sudo a2ensite cubecart.conf

Enable Apache rewrite mode.

$ sudo a2enmod rewrite

Restart Apache service.

$ sudo systemctl restart apache2

5. Access CubeCart

To access the CubeCart web interface, go to your browser and visit http://Server_IP/. For example:

http://192.0.2.10/

Conclusion

You have installed CubeCart on your Ubuntu 20.04 server. Access the installation wizard, connect to your database, create an administrator profile and complete the site settings. You can now access the main webpage and the administrator portal.