How to Install PrestaShop on Ubuntu 20.04

/ Category: Tutorials, Ubuntu / Comments: 3

how to install prestashop on ubuntu 20.04
Spread the love

In this tutorial, we are going to show you How to Install PrestaShop on Ubuntu 20.04.

PrestaShop is an open-source eCommerce platform written in PHP, that uses MySQL as a database server to store the information. It helps individuals or small business companies to raise their online shop and is very intuitive to use with its simplicity and easy features that you will discover after the installation. In this installation, we are going to explain every step of installing the LAMP stack because it is necessary for the PrestaShop to work properly.

Installing PrestaShop is a very easy and straightforward process. Let’s get started!

Table of Contents

Step 1. Update the System

Let’s assume that our Ubuntu 20.04 has fresh installation. That’s why we need to update the software to its latest version with the following command:

sudo apt update -y && sudo apt upgrade -y

Step 2. Install Apache2 as a web server

Execute the following command to install the Apache2 Web server:

sudo apt install apache2 -y

Once, the installation is completed start and enable the service:

sudo systemctl start apache2 && sudo systemctl enable apache2

To verify that the service is up and running execute the following command:

sudo systemctl status apache2

You should receive the following output:

[email protected]:~# sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-10-16 10:00:39 UTC; 8min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 68794 (apache2)
      Tasks: 6 (limit: 4617)
     Memory: 14.0M
     CGroup: /system.slice/apache2.service

Step 3. Install MariaDB as a database server

PrestaShop is using MySQL as a database server for data storage, and we will install it with the command below:

sudo apt install mariadb-server -y

Once, the installation is complete start the service:

sudo systemctl start mariadb

Verify that the service is up and running:

sudo systemctl status mariadb

You should see the following output:

[email protected]:~# sudo systemctl status mariadb
● mariadb.service - MariaDB 10.3.31 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-10-16 10:29:28 UTC; 1min 19s ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 91911 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 31 (limit: 4617)
     Memory: 67.7M
     CGroup: /system.slice/mariadb.service
             └─91911 /usr/sbin/mysqld

Step 4. Install PHP with dependencies

Install the required dependencies:

sudo apt install software-properties-common -y

Install latest version of PHP8.0. Add the Ondrej repository manually for Apache2:

sudo add-apt-repository ppa:ondrej/php

Now, you can install PHP 8.0 with all required dependencies:

sudo apt install php php-curl php-xmlrpc php-soap php-intl php-zip php-cli php-mysql php8.0-common php8.0-opcache php-gd php-mbstring php-xml php-gmp php-imagick -y

Check the PHP8.0 version:

php -v

You should see the following output:

[email protected]:~# php -v
PHP 8.0.11 (cli) (built: Sep 23 2021 21:26:24) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.11, Copyright (c), by Zend Technologies

Step 5. Create a PrestaShop Database

Connect to MySQL with the following command:

mysql

Create a database and user:

CREATE DATABASE prestashop;
GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
FLUSH PRIVILEGES;
EXIT;

Step 6. Download PrestaShop and Assign Permissions

Go to “/var/www/html” directory on your server:

cd /var/www/html

Download the latest PrestaShop version:

sudo wget https://github.com/PrestaShop/PrestaShop/releases/download/1.7.8.0/prestashop_1.7.8.0.zip

Once downloaded unzip it:

unzip prestashop_1.7.8.0.zip

Change the file and folders permissions:

chown -R www-data:www-data /var/www/html/ && chmod -R 755 /var/www/html/

Step 7. Create Apache Virtual Host File

Create a new configuration file:

sudo nano /etc/apache2/sites-available/prestashop.conf

Paste the following lines of code and change the “ServerName” to your domain

 
<virtualhost *:80="">

ServerName example.com
DocumentRoot /var/www/html/

ErrorLog ${APACHE_LOG_DIR}/example_error.log
CustomLog ${APACHE_LOG_DIR}/example_access.log combined

</virtualhost>

Save, close the file and enable the mod_rewrite and the configuration

sudo a2enmod rewrite && sudo a2ensite prestashop.conf

Now, restart the apache2 service

sudo systemctl restart apache2

Step 8. Access the PrestaShop Web Interface

Access the URL http://your_domain_name.com in the Web browser and allow some time for PrestaShop to install:

installing prestashop on ubuntu 20.04

Click on the bottom right Install

installation of prestashop on ubuntu 20.04

Click on the check for license agreement and click on the Next button.

setting up prestashop on ubuntu 20.04

Enter your credentials for your PrestaShop and click on the Next button.

how to set up prestashop on ubuntu 20.04

Enter the MySQL database user and password created in Step 5 test the configuration and click on the Next button.

configuration of prestashop on ubuntu 20.04

PrestaShop installation will be complete in no time.

how to configure prestashop on ubuntu 20.04

Once the installation is completed you should see the screen as in the picture below.

configuring prestashop on ubuntu 20.04

Click on the “Manage your store” button.

set up prestashop on ubuntu 20.04

Now go to your document root of the PrestaShop and delete the install folder for security reasons

cd /var/www/html/

rm -rf install/ 

Next, click on the PrestaShop admin URL. You will be redirected to the PrestaShop admin login page:

setting up and installing prestashop on ubuntu 20.04

Enter your credentials created before and hit on LOG IN button.

configuring and installing prestashop on ubuntu 20.04

Once, logged in the following page should be displayed

configuring and setting up prestashop on ubuntu 20.04

Done. You successfully installed and configured the PrestaShop on Ubuntu 20.04.

You can simply subscribe to any of our Linux VPS hosting plans and contact our experts about this. They will set up PrestaShop within minutes, completely free of charge for you. We are available 24/7.

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

Feedback

  Comments: 3


  1. PHP8.0 is not supported for PrestaShop. It says that 7.4 should be the latest version you have.


    • It is supported now. The installation from the article works well with PHP 8.


      • In their documentation it says that’s its still not supported for 1.7.8 and I could not get it to work at all with 8.0 installed. Following these instructions it still does not work.

Your feedback