How to Install Prestashop on CentOS 7

PrestaShop is one of the most popular open source e-commerce self-hosted platforms. PrestaShop is completely free and open source, used by thousands of online stores around the world. In this article, we will explain the process of installing the latest version of PrestaShop on a CentOS 7 VPS with Apache, MariaDB, and PHP. In this tutorial, we will show you how do you install Prestashop on CentOS 7 based server.

PrestaShop comes with hundreds of useful features, some of them are listed above:

  • Extendable with free, external or add-on modules
  • Wide choice of customizable e-commerce themes
  • Intuitive Interface
  • Easily manage your products and orders
  • More than 50 payments methods supported
  • and many more…

Prerequisites

– CentOS 7 VPS with SSH root access
– Apache 2.x or Nginx web server
– PHP version 5.4 or newer, with Mcrypt, OpenSSL, Zip, Curl, GD, and PDO extensions
– MySQL database server version 5.4 or newer with a database created

1. Login via SSH and update the system

In order to start installing the necessary services, we need to login to the CentoS 7 VPS via SSH as user root

ssh root@IP_Address -p Port_Number

Before we can continue, make sure that all installed packages are updated to the latest version

yum -y update

2. Install MariaDB

Next, install MariaDB database server on your VPS by executing the following command

yum -y install mariadb

Start the database server and enable it to automatically start upon server reboot

systemctl start mariadb
systemctl enable mariadb

After the installation is completed, run the ‘mysql_secure_installation’ script to set the password of the MariaDB ‘root’ user and additionally strengthen the security of the database server.

With this step, the installation of the MariaDB server is completed. Now, login to the database server as user root,

mysql -u root -p

MariaDB [(none)]> CREATE DATABASE prestashop;
MariaDB [(none)]> CREATE USER 'user'@'localhost' IDENTIFIED BY 'PASSWORD';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON prestashop.* TO 'user'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES
MariaDB [(none)]> exit

and of course, don’t forget to replace ‘PASSWORD’ with an actual strong password.

3. Install Apache Web Server

Install Apache from the official CentOS 7 repositories using the yum package manager

yum -y install httpd

start the web server and enable it to automatically start after reboot

systemctl start httpd
systemctl enable httpd

4. Install PHP 7.1

PHP 5.6 is the minimum supported PHP version, but PrestaShop runs perfectly on PHP 7.1 and this is the recommended version, so we will install it on our server. CentOS 7 by default is shipped with PHP 5.4, so we will need to add an extra repository in order to be able to install a newer PHP version.

Run the following commands to add the Webtatic EL repository

yum -y install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

and install PHP 7.1 along with the PHP extensions we mentioned in the prerequisites section
yum install php71w php71w-common php71w-curl php71w-mysql php71w-mcrypt php71w-gd php70w-cli php70-pdo

5. Download and unpack PrestaShop

Download the latest stable release of PrestaShop to your server. Currently, it is version 1.7.4.2

wget https://download.prestashop.com/download/releases/prestashop_1.7.4.2.zip

Unpack the archive to the document root directory of your server

unzip prestashop_1.7.4.2.zip -d /var/www/html
unzip prestashop_1.7.4.2.zip
unzip prestashop.zip -d /var/www/html/prestashop/

and set the correct permissions to the PrestaShop directory

chown apache:apache -R /var/www/html/prestashop/

6. Create Apache Virtual Host

At this point, you should be able to access your PrestaShop website using your server’s IP address. We will create a new Apache virtual host, so we can be able to access it with a domain name. Create a new virtual host directive with the following content:

vi /etc/httpd/conf.d/prestashop.conf

ServerAdmin [email protected]
DocumentRoot /var/www/html/prestashop/
ServerName your-domain.com
ServerAlias www.your-domain.com

Options +FollowSymlinks
AllowOverride Al

ErrorLog /var/log/httpd/prestashop-error_log
CustomLog /var/log/httpd/prestashop-access_log common

Save the file and restart the web server for the changes to take effect

systemctl restart httpd

7. Access and install PrestaShop

Now, since we already installed and configured all necessary services and packages, and downloaded PrestaShop, you should be able to access your PrestaShop e-commerce website at http://your-domain.com and follow the on-screen instructions to complete the installation from your favorite web browser. Once everything is properly installed, for security purposes you should remove the installation directory

rm -rf /var/www/html/prestashop/install/

For more details on how to configure and use PrestaShop, please check their official documentation.


Of course, you don’t have to Install PrestaShop on CentOS 7 if you use our Managed PrestaShop Hosting services, in which case you can simply ask our expert Linux admins to install PrestaShop on CentOS 7, for you. They are available 24×7 and will take care of your request immediately.

Installing PrestaShop on CentOS 7

PS. If you liked this post, on how to Install PrestaShop on CentOS, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment