Install PrestaShop on Ubuntu 20.04 LTS - Step by step guide ?

PrestaShop is an open-source e-commerce solution that allows you to maintain your own online shop. Its PrestaShop is 100% free. This software is published under the Open Software License (OSL). It is written in PHP programming language with support for the MySQL database management system. More than 250,000 e-commerce sites run on PrestaShop. It supports many different payment gateway systems like PayPal, Google Checkout, etc.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related PrestaShop queries.

In this context, we shall look into how to install PrestaShop on Ubuntu 20.04 LTS.

Steps to Install and Configure PrestaShop on Ubuntu 20.04 LTS Focal Fossa

1. Perform System Update

First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal:

$ sudo apt update
$ sudo apt upgrade

2. Install LAMP stack

This installation requires a LAMP server.  If you do not have LAMP installed, you can follow our guide here.

3. Install PrestaShop on the system

Now we run the commands below to download the latest version of PrestaShop:

$ wget
$ unzip -d /var/www/html

We will need to change some folders permissions:

$ sudo chown -R www-data:www-data /var/www/prestashop/
$ sudo chmod -R 755 /var/www/prestashop/

4. Configure MariaDB for PrestaShop

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

$ mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next, we will need to log in to the MariaDB console and create a database for the PrestaShop. Run the following command:

$ mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for PrestaShop installation:

CREATE DATABASE prestashopdb;
CREATE USER 'prestashopuser'@'localhost' IDENTIFIED BY 'Your-Passwd';
GRANT ALL PRIVILEGES ON `prestashopdb`.* TO 'prestashopuser'@'localhost';

5. Configure Apache web server for PrestaShop

Here, we will Create a new virtual host directive in Apache. For example, create a new Apache configuration file named 'prestashop.conf' on your virtual server:

$ touch /etc/apache2/sites-available/prestashop.conf
$ ln -s /etc/apache2/sites-available/prestashop.conf $ /etc/apache2/sites-enabled/prestashop.conf
$ nano /etc/apache2/sites-available/prestashop.conf

Add the following lines:

<VirtualHost *:80>
DocumentRoot /var/www/html/prestashop/
<Directory /var/www/html/prestashop/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/apache2/
CustomLog /var/log/apache2/ common

Now, we can restart the Apache webserver so that the changes take place:

$ sudo a2enmod rewrite
$ sudo a2ensite prestashop.conf 
$ sudo systemctl restart apache2.service

6. Set up HTTPS

We should enable a secure HTTPS connection on PrestaShop. We can obtain a free TLS certificate from Let’s Encrypt. Install Let’s Encrypt client (certbot) from Ubuntu 20.04 repository:

$ sudo apt install certbot python3-certbot-apache

Next, run the following command to obtain a free TLS certificate using the Apache plugin:

$ sudo certbot --apache --agree-tos --redirect --staple-ocsp --email -d

If the test is successful, reload Apache for the change to take effect:

$ sudo apache2ctl -t
$ sudo systemctl reload apache2

How to access PrestaShop Web Interface ?

PrestaShop will be available on HTTP port 80 by default. Open your favorite browser and navigate to or https://server-ip-address/ and complete the required steps to finish the installation. 

If you are using a firewall, please open port 80 to enable access to the control panel.

[Need assistance in configuring PrestaShop on your Linux server ? We can help you. ]

This article covers the process of installing PrestaShop on Ubuntu 20.04 LTS Focal Fossa system. In fact, PrestaShop is an open-source e-commerce platform. It allows entrepreneurs and companies to create and develop their own e-commerce sites.

How to Secure PrestaShop with Let's Encrypt SSL ?

1. You can install the Certbot client to install the Let's Encrypt SSL for PrestaShop by running the below command:

$ dnf install letsencrypt python3-certbot-apache

2. Next, obtain and install an SSL certificate for your lets domain with the following command:

$ certbot --apache -d

You will be asked to provide your email address and accept the term of service

3. Finally, You can now access your website securely using the URL

Related Posts