How To Install CubeCart on Ubuntu 24.04 LTS
Creating a robust and efficient online store is essential for any eCommerce business aiming to thrive in today’s digital marketplace. CubeCart, an open-source eCommerce platform, offers a comprehensive solution for businesses of all sizes. When paired with Ubuntu 24.04 LTS, a stable and secure Linux distribution, you get a powerful combination for hosting your online store. This guide provides a detailed, step-by-step process to install CubeCart on Ubuntu 24.04 LTS, ensuring a smooth and secure setup.
Prerequisites and System Requirements
Before diving into the installation process, it’s crucial to ensure that your server meets the necessary prerequisites and system requirements to run CubeCart efficiently.
- Hardware Requirements:
- Minimum 2 GB RAM (4 GB or more recommended for optimal performance)
- At least 20 GB of free disk space
- Dual-core CPU or higher
- Software Requirements:
- Ubuntu 24.04 LTS operating system
- Web server: Apache or Nginx
- MariaDB or MySQL database server
- PHP 7.4 or higher with necessary extensions
- CubeCart installation package
- User Permissions:
- Root or sudo access to the server
Step 1: Update and Prepare the Server
Keeping your server updated is vital for security and performance. Start by updating the system package list and upgrading installed packages. Open your terminal and execute the following commands:
sudo apt update && sudo apt upgrade -y
Next, set the correct timezone and locale to ensure server consistency. Replace “Your/Timezone” with your actual timezone:
sudo timedatectl set-timezone Your/Timezone
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=en_US.UTF-8
Verify the updates and configurations to ensure everything is set correctly:
sudo apt update
sudo apt upgrade -y
Step 2: Install Web Server (Nginx or Apache)
CubeCart can be served using either Apache or Nginx. This guide covers both options, allowing you to choose based on your preference.
Option A: Installing Nginx
Nginx is known for its high performance and low resource consumption, making it an excellent choice for hosting eCommerce sites.
- Install Nginx:
sudo apt install nginx -y
- Start and enable Nginx to run on startup:
sudo systemctl start nginx
sudo systemctl enable nginx
- Verify the installation by navigating to your server’s IP address in a web browser. You should see the Nginx welcome page.
Option B: Installing Apache
Apache is a widely-used web server with a rich set of features and robust community support.
- Install Apache:
sudo apt install apache2 -y
- Start and enable Apache to run on startup:
sudo systemctl start apache2
sudo systemctl enable apache2
- Verify the installation by navigating to your server’s IP address in a web browser. You should see the Apache2 Ubuntu Default Page.
Step 3: Install MariaDB Database Server
CubeCart relies on a database to store product information, user data, and more. MariaDB is a preferred choice due to its performance and compatibility.
- Install MariaDB:
sudo apt install mariadb-server mariadb-client -y
- Start and enable MariaDB:
sudo systemctl start mariadb
sudo systemctl enable mariadb
- Secure the MariaDB installation by running the security script:
sudo mysql_secure_installation
Follow the prompts to set the root password, remove anonymous users, disallow root login remotely, remove the test database, and reload privilege tables.
- Create a database and user for CubeCart:
Log into MariaDB:
sudo mariadb
Within the MariaDB console, execute the following commands, replacing “cubecartpassword
” with a strong password:
CREATE DATABASE cubecartdb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'cubecartuser'@'localhost' IDENTIFIED BY 'cubecartpassword';
GRANT ALL PRIVILEGES ON cubecartdb.* TO 'cubecartuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
This creates a dedicated database and user with the necessary permissions for CubeCart.
Step 4: Install PHP and Required Extensions
CubeCart is built with PHP, so installing PHP and its extensions is essential for the platform to function correctly.
- Add the PPA repository for the latest PHP versions:
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
- Install PHP and necessary extensions:
sudo apt install php7.4 php7.4-fpm php7.4-mysql php7.4-curl php7.4-json php7.4-mbstring php7.4-intl php7.4-soap php7.4-gd php7.4-xml php7.4-cli php7.4-bcmath php7.4-zip -y
- Verify the PHP installation:
php -v
-
-
- Configure PHP settings for optimal performance:
-
Edit the php.ini
file:
sudo nano /etc/php/7.4/fpm/php.ini
Adjust the following settings:
-
-
- memory_limit = 256M
- upload_max_filesize = 50M
- post_max_size = 50M
- max_execution_time = 300
-
Save and close the file, then restart PHP-FPM:
sudo systemctl restart php7.4-fpm
Step 5: Download and Configure CubeCart Files
With the server environment prepared, the next step is to download CubeCart and set it up in the web server’s root directory.
- Navigate to the /tmp directory:
cd /tmp/
- Download the latest CubeCart package from the official website. Replace the URL with the latest version if necessary:
wget https://www.cubecart.com/thank-you/CubeCart-6.5.6.zip
- Create the CubeCart installation directory within the web server’s root:
- For Nginx:
sudo mkdir -p /var/www/cubecart
- For Apache:
sudo mkdir -p /var/www/cubecart
Extract the downloaded CubeCart files to the installation directory:
sudo unzip CubeCart-*.zip -d /var/www/cubecart/
Remove the zip file to keep the server clean:
sudo rm CubeCart-*.zip
Set the appropriate permissions to ensure the web server can access CubeCart files:
sudo chown -R www-data:www-data /var/www/cubecart/
sudo chmod -R 755 /var/www/cubecart/
Step 6: Configure Web Server for CubeCart
Now, configure your chosen web server to serve the CubeCart application correctly.
For Nginx:
- Create a new server block configuration file for CubeCart:
sudo nano /etc/nginx/sites-available/cubecart
- Paste the following configuration, replacing “your_domain.com” with your actual domain or server IP:
server {
listen 80;
server_name your_domain.com;
root /var/www/cubecart;
index index.php index.html index.htm;
access_log /var/log/nginx/cubecart_access.log;
error_log /var/log/nginx/cubecart_error.log;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
- Enable the CubeCart site and test the configuration:
sudo ln -s /etc/nginx/sites-available/cubecart /etc/nginx/sites-enabled/
sudo nginx -t
- Reload Nginx to apply the changes:
sudo systemctl reload nginx
For Apache:
- Create a new virtual host configuration file for CubeCart:
sudo nano /etc/apache2/sites-available/cubecart.conf
- Paste the following configuration, replacing “your_domain.com” with your actual domain or server IP:
<VirtualHost *:80>
ServerAdmin admin@your_domain.com
ServerName your_domain.com
DocumentRoot /var/www/cubecart
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/cubecart_error.log
CustomLog ${APACHE_LOG_DIR}/cubecart_access.log combined
</VirtualHost>
- Enable the CubeCart site and the rewrite module:
sudo a2ensite cubecart.conf
sudo a2enmod rewrite
- Test the Apache configuration and reload the service:
sudo apache2ctl configtest
sudo systemctl reload apache2
Step 7: Secure Your Installation with SSL/TLS
Securing your CubeCart installation with SSL/TLS ensures encrypted data transmission, enhancing security and trust.
- Install Certbot, a tool for obtaining Let’s Encrypt SSL certificates:
- For Nginx:
sudo apt install certbot python3-certbot-nginx -y
- For Apache:
sudo apt install certbot python3-certbot-apache -y
- Obtain and install the SSL certificate:
- For Nginx:
sudo certbot --nginx -d your_domain.com
- For Apache:
sudo certbot --apache -d your_domain.com
- Follow the prompts to complete the SSL setup.
- Enable automatic certificate renewal:
sudo systemctl enable certbot.timer
Note: Replace “your_domain.com” with your actual domain name. After installation, verify the HTTPS configuration by accessing your site via https://your_domain.com
.
Step 8: Complete CubeCart Installation via Web Interface
With the server-side configurations complete, it’s time to finalize the CubeCart installation through the web interface.
Open your web browser and navigate to your server’s domain or IP address:
http://your_domain.com/
-
-
- You will be greeted by the CubeCart installation wizard. Proceed by clicking on “Continue.”
- **Compatibility Check**: CubeCart will verify that your server environment meets all requirements. Ensure all checks pass before proceeding.
- **License Agreement**: Read through the terms and conditions. If you agree, accept the license to continue.
- **Database Configuration**:
- Database Host: localhost
- Database Name: cubecartdb
- Database User: cubecartuser
- Database Password: cubecartpassword
- **Store Settings**:
- Store Name
- Admin Email
- Admin Username and Password
- Click “Continue” to initiate the installation process.
- Upon successful installation, you’ll receive confirmation and links to access both the front-end and the admin dashboard.
-
Step 9: Post-installation Security Tips
Ensuring the security of your CubeCart installation is paramount. Follow these post-installation steps to enhance security:
- Remove Installation Directory: Delete the installation folder to prevent unauthorized access.
sudo rm -rf /var/www/cubecart/install
- Regular Updates: Keep CubeCart, the web server, database server, and PHP updated to the latest versions to protect against vulnerabilities.
- Strong Passwords: Use complex passwords for database and admin accounts to prevent unauthorized access.
- Firewall Configuration: Implement firewall rules to restrict access to essential ports only.
sudo ufw allow 'Nginx Full' # For Nginx
sudo ufw allow 'Apache Full' # For Apache
sudo ufw enable
- Enable HTTPS: Ensure all traffic is encrypted by forcing HTTPS connections.
Congratulations! You have successfully installed CubeCart. Thanks for using this tutorial for installing CubeCart CMS on your Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official CubeCart website.