UbuntuUbuntu Based

How To Install osCommerce on Ubuntu 24.04 LTS

Install osCommerce on Ubuntu 24.04

Launching an online store can be a game-changer for your business. osCommerce, a robust open-source e-commerce platform, provides the tools you need to build and manage a successful online store. Coupled with Ubuntu 24.04, the latest Long-Term Support (LTS) version, you get a stable and secure environment to host your e-commerce website. This comprehensive guide will walk you through the step-by-step process of installing osCommerce on Ubuntu 24.04, ensuring a smooth setup for your online business.

Prerequisites

Before diving into the installation process, it’s essential to ensure that your system meets all the necessary requirements and that you have the essential tools at your disposal.

System Requirements

  • Processor: Dual-core, 2 GHz or higher.
  • RAM: Minimum 4 GB (recommended).
  • Storage: At least 25 GB of free space.

Required Software and Tools

  • Ubuntu 24.04 installed on your server.
  • Access to the terminal with sudo privileges.
  • Apache or Nginx web server installed.
  • PHP and necessary extensions.
  • MariaDB or MySQL database server.

Network Connection

A stable internet connection is crucial for downloading necessary packages and updates during the installation process.

Preparing the Ubuntu Environment

Setting up a clean and updated environment ensures that osCommerce will run smoothly on your server. Follow these steps to prepare your Ubuntu system.

Update System Packages

Start by updating your system’s package list and upgrading existing packages to their latest versions.

sudo apt update && sudo apt upgrade -y

Install Required Dependencies

Install the essential components needed to run osCommerce. You can choose between Apache or Nginx as your web server.

Installing Apache

If you prefer Apache, execute the following commands:

sudo apt install apache2

After installation, manage the Apache service:

sudo systemctl stop apache2
sudo systemctl start apache2
sudo systemctl enable apache2

Installing Nginx

For those opting for Nginx, use these commands:

sudo apt install nginx

Manage the Nginx service:

sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl enable nginx

Install PHP and Extensions

osCommerce requires PHP along with specific extensions. Install them using the following command:

sudo apt install php php-mysql php-curl php-json php-mbstring php-xml libapache2-mod-php

Install MariaDB

MariaDB serves as the database backend for osCommerce. Install it with:

sudo apt install mariadb-server mariadb-client

Enable and start the MariaDB service:

sudo systemctl stop mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb

Configure Firewall

Ensure that your firewall settings allow HTTP and HTTPS traffic:

sudo ufw allow 'Apache Full'

For Nginx, use:

sudo ufw allow 'Nginx Full'

Verify Services Are Running

Check the status of your web server and MariaDB to confirm they are active:

systemctl status apache2 mariadb
# or for Nginx
systemctl status nginx mariadb

Setting Up MariaDB Database for osCommerce

Creating a dedicated database and user for osCommerce ensures efficient and secure data management.

Secure MariaDB Installation

Run the security script to set the root password and secure the MariaDB installation:

sudo mysql_secure_installation

Follow the prompts to set a strong root password and remove anonymous users.

Create Database and User

Access the MariaDB console:

sudo mysql -u root -p

Once logged in, execute the following SQL commands:

CREATE DATABASE oscommerce_db;

CREATE USER 'oscommerce_user'@'localhost' IDENTIFIED BY 'secure_password';

GRANT ALL PRIVILEGES ON oscommerce_db.* TO 'oscommerce_user'@'localhost';

FLUSH PRIVILEGES;

EXIT;

Replace `’secure_password‘` with a strong password of your choice.

Downloading and Installing osCommerce

With the environment prepared and the database set up, it’s time to download and install osCommerce.

Download osCommerce Files

Navigate to the Downloads directory and download the latest osCommerce package:

cd ~/Downloads
wget https://github.com/osCommerce/oscommerce2/archive/refs/tags/v2.4.0.zip -O oscommerce-latest.zip

Ensure you replace the URL with the latest version if a newer one is available.

Extract and Move Files to Web Directory

Unzip the downloaded file and move its contents to the web root directory:

sudo unzip oscommerce-latest.zip -d /var/www/html/
sudo mv /var/www/html/oscommerce2-2.4.0 /var/www/html/oscommerce

Set Permissions

Adjust ownership and permissions to allow the web server to interact with osCommerce files securely:

sudo chown -R www-data:www-data /var/www/html/oscommerce
sudo chmod -R 755 /var/www/html/oscommerce

Configure Apache Virtual Host for osCommerce

Set up a virtual host to serve osCommerce efficiently.

Create a new Apache configuration file:

sudo nano /etc/apache2/sites-available/oscommerce.conf

Add the following content, replacing `example.com` with your domain name:

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

    <Directory /var/www/html/oscommerce/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>

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

Enable the new site and restart Apache:

sudo a2ensite oscommerce.conf
sudo systemctl restart apache2

For Nginx users, create a similar server block configuration and restart Nginx.

Configuring osCommerce Installation Wizard

With osCommerce files in place, proceed to the web-based installation wizard to complete the setup.

Access the Installation Wizard

Open your web browser and navigate to:

http://your-server-ip/oscommerce

You should see the osCommerce installation interface.

Install osCommerce on Ubuntu 24.04

Follow the Installation Steps

  1. Select Language Preferences: Choose your preferred language for the installation process.
  2. Enter Database Credentials:
    • Database Name: oscommerce_db
    • Username: oscommerce_user
    • Password: secure_password
    • Hostname: localhost
    • Port: 3306 (default)
  3. Configure Store Settings: Provide your store name, admin email, and other relevant details.
  4. Complete the Installation: Review your settings and proceed to finalize the installation.

Post-installation Configuration

After successfully installing osCommerce, perform essential configurations to secure and optimize your store.

Delete the Installation Directory

For security reasons, remove the installation files:

sudo rm -rf /var/www/html/oscommerce/install/

Secure Admin Panel Access

Change default admin credentials and enforce HTTPS to protect your admin panel:

    • Update the admin username and password to strong, unique values.
    • Install SSL/TLS certificates using Let’s Encrypt:
sudo apt install certbot python3-certbot-apache
sudo certbot --apache -d example.com

Follow the prompts to obtain and install the SSL certificate.

Adjust PHP Settings

Modify PHP configurations to meet the requirements of osCommerce:

Edit the PHP configuration file:

sudo nano /etc/php/7.4/apache2/php.ini

Adjust parameters such as memory_limit and upload_max_filesize:

  • memory_limit: 256M
  • upload_max_filesize: 50M

Save the changes and restart Apache:

sudo systemctl restart apache2

Testing and Troubleshooting

Ensure that your osCommerce store is operational and address any potential issues.

Verify Store Accessibility

Visit your store’s URL in a web browser to confirm that it’s accessible and functioning correctly.

Common Issues and Fixes

  • Permission Errors: Recheck file ownership and permissions.
    sudo chown -R www-data:www-data /var/www/html/oscommerce
    sudo chmod -R 755 /var/www/html/oscommerce
  • Database Connection Errors: Verify that the database credentials in the configuration files are correct.
  • Web Server Not Loading osCommerce: Ensure that the virtual host is correctly configured and enabled.

Congratulations! You have successfully installed osCommerce. Thanks for using this tutorial for installing the latest version of Open Source Commerce (osCommerce) on Ubuntu 24.04 LTS. For additional help or useful information, we recommend you to check the official osCommerce website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button