In this article, we will guide you on how to install OpenCart on Ubuntu 22.04 LTS.
OpenCart is a popular open-source e-commerce platform that allows users to create online stores and sell products. It offers various features such as multiple payment gateways, shipping methods, and product categories.
- Step 1: Update Ubuntu
Before installing OpenCart, it is essential to update your Ubuntu system to the latest version. You can do this by running the following command in the terminal:
sudo apt update && sudo apt upgrade
This command will update all the packages on your system to the latest version.
- Step 2: Install LAMP Stack
OpenCart requires a LAMP stack to run, which stands for Linux, Apache, MySQL, and PHP. You can install the LAMP stack on Ubuntu by running the following command:
sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql
Install the required php-extensions by running the command below:
sudo apt install php-zip php-curl php-gd
During the installation process, you will be prompted to set up a MySQL root password. Make sure to remember this password as you will need it later.
- Step 3: Create a Database for OpenCart
After installing the LAMP stack, you need to create a database for OpenCart. You can do this by running the following command in the terminal:
sudo mysql -u root -p
This command will open the MySQL prompt. Enter your MySQL root password when prompted. Then, create a new database by running the following command:
CREATE DATABASE opencart;
Next, create a new user and grant them privileges on the database by running the following commands:
CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON opencart.* TO 'opencartuser'@'localhost';
exit
Note: Make sure to replace ‘password’ with a strong password of your choice.
- Step 4: Download and Extract OpenCart
Next, download the latest version of OpenCart from their official website. You can do this by running the following command in the terminal:
wget https://github.com/opencart/opencart/releases/download/4.0.1.1/opencart-4.0.1.1.zip
Once the download is complete, extract the zip file by running the following command:
unzip opencart-4.0.1.1.zip
This will create a new directory called ‘upload’ containing all the necessary files for OpenCart.
- Step 5: Configure OpenCart
Now that you have downloaded and extracted OpenCart, it is time to configure it. Move the ‘upload’ directory to your Apache web server’s document root directory by running the following command:
sudo mv upload /var/www/html/opencart
Next, change the ownership of the ‘opencart’ directory to the Apache user by running the following command:
sudo chown -R www-data:www-data /var/www/html/opencart/
Finally, rename the ‘config-dist.php’ file located in the ‘opencart’ directory to ‘config.php’ by running the following command:
sudo mv /var/www/html/opencart/config-dist.php /var/www/html/opencart/config.php
sudo cp /var/www/html/opencart/config.php /var/www/html/opencart/admin/
sudo chown -R www-data:www-data /var/www/html/opencart/
Restart apache web server:
sudo systemctl restart apache2
- Step 6: Install OpenCart
Now that you have configured OpenCart, you can access it by navigating to your server’s IP address or domain name in your web browser. you can access OpenCart by entering http://your_server_IP/opencart in your web browser.
Accept the licence by clicking on continue button as shown above.
Next, you will be directed to the pre/installation step to verify all required extensions, packages files, so click continue if all is green as shown below:
You will be prompted to enter your database details, including the database name, username, password, and hostname. Enter the details you created earlier in Step 3 and click on the ‘Continue’ button as shown below:
Also you have to set up an admin account for OpenCart. Enter your desired username, password, and email address and click on the ‘Continue’ button.
And then, Here we go!!
Congratulations! You have successfully installed OpenCart on Ubuntu 22.04 LTS. You can now start customizing your online store and adding products to it.
Install OpenCart -Conclusion
That’s it
Thanks.