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
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;
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
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
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
sudo ufw allow http
sudo ufw allow https
sudo systemctl restart apache2
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.