How to Install OpenCart on Ubuntu 18.04
How to Install OpenCart on Ubuntu 18.04
[edit]1. Install Apache and PHP
To install the Apache web server, run the following command:
sudo apt-get install apache2
After the installation is complete, you should enable Apache to start automatically.
sudo systemctl enable apache2
check the status of your Apache service
sudo systemctl status apache2
INSTALL PHP
sudo apt-get install php libapache2-mod-php sudo apt-get install php-cli php-common php-mbstring php-gd php-intl php-xml php-mysql php-zip php-curl php-xmlrpc
Restart the Apache web server to load the PHP modules:
sudo systemctl restart apache2
Now check the PHP version installed on your server:
php -v
Step 2: Install Mysql
[edit]
sudo apt install mysql-server sudo mysql_secure_installation
when prompted press enter and provide the information.
3. Create a Database for OpenCart
[edit]Create MySQL database for OpenCart site. Log in to MySQL server with the following command and enter your MySQL root password:
sudo mysql -u root -p
Create a new MySQL database opencart and assign user access to it to a new user admin_user with the password Strong_Password:
CREATE DATABASE opencart; GRANT ALL PRIVILEGES ON opencart.* TO 'admin_user'@'localhost' IDENTIFIED BY 'Strong_Password'; FLUSH PRIVILEGES; exit;
4. Download the Latest Release of OpenCart
[edit]Download opencart from Github (v.3.0.3.1)
sudo wget https://github.com/opencart/opencart/releases/download/3.0.3.1/opencart-3.0.3.1.zip sudo unzip opencart-3.0.3.1 sudo mv upload/ /var/www/html/opencart sudo cd /var/www/html/opencart/ sudo cp config-dist.php config.php sudo cp admin/config-dist.php admin/config.php
Then run the commands below to set the correct permissions for OpenCart to function.
sudo chown -R www-data:www-data /var/www/html/opencart/
5: Configure Apache2
Create the virtual host configuration file for your domain,your_domain.com:
sudo nano /etc/apache2/sites-available/your_domain.com.conf
Then copy and paste the content below into the file and save it. Replace the “your_domain.com” with own domain name and directory root location.
Activate the virtual host by creating a symbolic link :
sudo ln -s /etc/apache2/sites-available/your_domain.com.conf /etc/apache2/sites-enabled/your_domain.com.conf
Restart Apache for the changes to take effect:
sudo systemctl restart apache2
To access your OpenCart installation, you will need to type the following URL in your web browser: