Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Mahmood-Hussain/47257d137450f5ff2d015d2e4af4ce7a to your computer and use it in GitHub Desktop.
Save Mahmood-Hussain/47257d137450f5ff2d015d2e4af4ce7a to your computer and use it in GitHub Desktop.

Instaling opencart 3.0.3.8 on Ubuntu 20.04, PHP 7.4, Apache2

Install PHP and its dependencies

sudo apt update
sudo apt -y install software-properties-common
 sudo add-apt-repository ppa:ondrej/php
 sudo apt update
 sudo apt install apache2 mysql-server php7.4 libapache2-mod-php7.4 php7.4-mysql php7.4-curl php7.4-xml php7.4-zip php7.4-gd php7.4-cli php7.4-fpm libapache2-mod-fcgid wget unzip -y

Create Database

sudo mysql -u root -p
 CREATE DATABASE opencart308_db;
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'StrongPassword';
 GRANT ALL PRIVILEGES ON opencart308_db . * TO 'new_user'@'localhost';
 FLUSH PRIVILEGES;
 exit;

Install Opencart

 wget https://github.com/opencart/opencart/releases/download/3.0.3.8/opencart-3.0.3.8.zip
 unzip opencart-3.0.3.8.zip
 sudo mkdir /var/www/html/opencart/upload
 mv upload/* /var/www/html/opencart/upload
 sudo cp /var/www/html/opencart/upload/{config-dist.php,config.php}
 sudo cp /var/www/html/opencart/upload/admin/{config-dist.php,config.php}
 sudo chown -R www-data:www-data /var/www/html/opencart/upload
 sudo chmod -R 755 /var/www/html/opencart/upload

Configure Apache2

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

add following to it

 <VirtualHost *:80>

    ServerAdmin admin@jk-deals.com

    DocumentRoot /var/www/html/opencart/upload/

    ServerName yourshop.com

    ServerAlias www.yourshop.com



    <Directory /var/www/html/opencart/upload/>

        Options FollowSymLinks

        AllowOverride All

        Order allow,deny

        Allow from all

    </Directory>



    ErrorLog /var/log/apache2/yourshop.com-error_log

    CustomLog /var/log/apache2/yourshop.com-access_log common

 </VirtualHost>
 sudo a2dissite 000-default.conf
 sudo a2ensite opencart.conf
 sudo a2enmod rewrite
 sudo systemctl restart apache2

Install Certbot

 sudo snap install core; sudo snap refresh core
 sudo apt remove certbot
 sudo snap install --classic certbot
 sudo ln -s /snap/bin/certbot /usr/bin/certbot
 certbot --apache --redirect -d yourshop -d www.yourshop.com -m admin@yourshop.com --agree-tos

NOTE: If root is changed after installing ssl there would be error in accessing the website so you have to modify files inside sudo nano /etc/apache2/sites-available/ directory

Firewall

 sudo ufw allow http
 sudo ufw allow https
 sudo systemctl restart apache2

Razorpay Payment Gateway Plugin

 wget https://github.com/razorpay/razorpay-opencart/archive/refs/tags/opencart3-1.0.5.zip 
 unzip opencart3-1.0.5.zip 

Install rsync if not

 sudo apt install rsync

Copy or merge files

 rsync -avh --progress razorpay-opencart-opencart3-1.0.5/ /var/www/html/opencart/upload/

Login to your admin panel, in extensions >> payments install, enable razorpay and add your credentials to start using it.

Visit your shop IP address

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment