Overview
OpenCart is a popular open-source shopping cart system thatis feature-rich, easy to use, and designed to create a robust online store.This guide will walk you through the process of installing OpenCart on yourVirtual Private Server (VPS) provided by HSJ.HOST, enabling you to build andcustomise your e-commerce platform.
Prerequisites
- A VPS account with HSJ.HOST.
- SSH access to your server.
- A LAMP (Linux, Apache, MySQL, PHP) stack installed on your VPS.
- Basic knowledge of the Linux command line.
Procedure
1. Access Your VPS via SSH
- Open a terminal on your device.
- Connect to your VPS by running ssh user@your_vps_ip, substituting user with your actual username and your_vps_ip with your VPS's IP address.
2. Update Your Server's Package List
- Ensure your server is up to date with sudo apt update and optionally upgrade your packages using sudo apt upgrade.
3. Create a MySQL Database for OpenCart
- Access MySQL as the root user with sudo mysql -u root -p.
- Create a database for OpenCart:
Sql code
CREATE DATABASE opencart_db;
- Create a new user and grant them privileges on the database:
sql code
CREATE USER 'opencart_user'@'localhost' IDENTIFIED BY'a_strong_password'; GRANT ALL PRIVILEGES ON opencart_db.* TO'opencart_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
4. Download and Install OpenCart
- Navigate to the web root directory, typically /var/www/html, and download the latest version of OpenCart:
ruby code
wgethttps://github.com/opencart/opencart/releases/download/3.0.3.6/opencart-3.0.3.6.zip
- Install unzip if it's not already installed: sudo apt install unzip.
- Unzip the OpenCart archive:
Python code
unzip opencart-3.0.3.6.zip
- Move the OpenCart files to the web root directory:
bash code
mv upload/* /var/www/html/
- Rename the configuration files:
arduino code
mv config-dist.php config.php mv admin/config-dist.phpadmin/config.php
5. Adjust File Permissions
- Set the proper permissions for OpenCart to function correctly:
Bash code
chown -R www-data:www-data /var/www/html/ find/var/www/html/ -type d -exec chmod 755 {} \; find /var/www/html/ -type f -execchmod 644 {} \;
6. Finalise OpenCart Installation via Web Interface
- Point your web browser to http://your_vps_ip.
- Follow the OpenCart installation wizard, entering the database details created earlier and setting up your administrative user.
Conclusion
Congratulations, you have successfully installed OpenCart onyour VPS. You can now begin the exciting journey of building your online store,adding products, and customising your site with themes and extensions to caterto your business needs.