First, lets create a MySQL user and database for OpenCart:
# echo "CREATE DATABASE opencartdb;" | mysql -u root -p # echo "CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'PASSWORD';" | mysql -u root -p # echo "GRANT ALL PRIVILEGES ON opencartdb.* TO 'opencartuser'@'localhost';" | mysql -u root -p # echo "FLUSH PRIVILEGES;" | mysql -u root -p
Please remember that ‘PASSWORD’ should be changed with your actual password.
Install the following PHP extensions on your server if they are not already installed:
# yum install php-mysql php-gd php-curl php-pecl-zip
And restart your Apache server by executing:
# /etc/init.d/httpd restart
Download the latest stable version of OpenCart and unpack it:
# cd /tmp # wget https://github.com/downloads/opencart/opencart/opencart_v184.108.40.206.zip && unzip opencart*
Copy all the files and directories from ‘/tmp/opencart_v220.127.116.11’ to a directory accessible by the web:
# rsync -Waq /tmp/opencart_v18.104.22.168/upload/ /var/www/html/opencart
The OpenCart directory should be owned by the Apache user:
# chown -R apache: /var/www/html/opencart
Set the correct permissions:
# cd /var/www/html/opencart # chmod 755 image/ image/cache/ image/data/ system/cache/ system/logs/ download/ config.php admin/config.php
With this step, the installation from the command line is finished.
Now, navigate your browser to http://yourdomain.com/opencart and follow the on-screen instructions. The installation will check if the server settings match the OpenCart requirements and if the OpenCart files and directories are writable by the web server. Also you will be prompted to enter the name, username and password of the newly created MySQL database.
After all, do not forget to delete the installation directory:
# rm -rf /var/www/html/opencart/install
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.