OpenCart is a popular open source shopping cart solution designed to provide excellent functionality, ease of use, and appearance. With OpenCart, you can easily build an online store on a LAMP- or LEMP-based server.
In this tutorial, we will introduce how to install OpenCart on a Vultr LEMP server instance.
Deploy a fresh server instance with the one-click Vultr LEMP App.
Log in as a sudo user from your SSH terminal.
Find the default MySQL credentials of Vultr LEMP:
sudo cat /root/.my.cnf
Use the credentials displayed on the screen to log into MySQL:
mysql -u root -p
Create a database in the MySQL shell with the following commands. Be sure to replace the database name "opencart", the user name "opencartuser", and the password "opencartpassword" with your own ones.
CREATE DATABASE opencart; CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'opencartpassword'; GRANT ALL PRIVILEGES on *.* TO 'opencartuser'@'localhost' IDENTIFIED BY 'opencartpassword' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
Download the latest stable version of OpenCart, which as of writing is 188.8.131.52, from its github repository:
cd ~ wget https://github.com/opencart/opencart/archive/184.108.40.206.tar.gz
Unzip the OpenCart package, delete the default files in your server's Web directory, and then move necessary files into it:
tar -zxvf 220.127.116.11.tar.gz cd /usr/share/nginx/html/ sudo rm background.jpg index.php logo.png sudo cp -R ~/opencart-18.104.22.168/upload/* .
Setup the configuration files:
sudo mv config-dist.php config.php sudo mv admin/config-dist.php admin/config.php
Modify the ownership of each installation file:
sudo chown -R nginx:nginx ./* sudo service nginx restart
Visit http://[your-server-ip] from your browser to continue the installation.
First, click the "Continue" button to agree the license.
On the second screen, check server requirements for installing OpenCart. With a Vultr LEMP server instance configured as above, these requirements are already satisfied. Click the "Continue" button to move on.
On the third screen, input the database name, the database username, and the database password you have setup in step 1, then fill in a username, a password and an email address for administration. Click the "Continue" button to finish the installation.
For security purposes, you should also perform the following instructions on your machine.
Delete the "install" directory:
sudo rm -r /usr/share/nginx/html/install
Rename the "admin" directory to a name which is hard to guess, like "c2tdfjk":
sudo mv admin c2tdfjk
Modify the "config.php" file in the "c2tdfjk" directory, replace every instance of "admin" with "c2tdfjk":
cd c2tdfjk sudo sed -i "s/admin/c2tdfjk/g" config.php
In the future, you can only access your admin panel from "http://[your-server-ip]/c2tdfjk".
Now, you can visit your new online store from "http://[your-server-ip]". Enjoy it.