Nov 17, 2023 9 min read

How to Install PrestaShop on Ubuntu 20.04

Install PrestaShop on Ubuntu 20.04 with our step-by-step tutorial. It enables businesses to create and manage their online stores easily.

Install PrestaShop on Ubuntu 20.04
Table of Contents

Choose a different version or distribution


Before, we begin talking about the steps to install PrestaShop on Ubuntu 20.04. First, let's understand – What is PrestaShop?

PrestaShop is a popular e-commerce platform that enables businesses to create and manage their online stores easily. With its user-friendly interface and extensive range of features, PrestaShop allows entrepreneurs to sell products or services effectively.

It offers customizable templates, secure payment gateways, inventory management, and SEO-friendly tools to optimize search engine rankings. PrestaShop empowers businesses of all sizes to establish a strong online presence and grow their sales in the competitive digital marketplace.

In this tutorial, you will install PrestaShop on Ubuntu 20.04. We will also answer few FAQs related to the PrestaShop installation.

Advantages of PrestaShop

  1. User-friendly interface: PrestaShop provides a simple and intuitive interface, making it easy for users to set up and manage their online stores.
  2. Customization options: With a wide range of customizable templates and themes, PrestaShop allows businesses to create unique and attractive storefronts.
  3. Secure payment gateways: PrestaShop integrates with various secure payment providers, ensuring safe transactions for customers.
  4. Inventory management: The platform offers robust inventory management tools, helping businesses keep track of stock levels and streamline operations.
  5. SEO-friendly: PrestaShop includes built-in SEO features to optimize online stores for search engines, increasing visibility and driving organic traffic.

Prerequisites to Install PrestaShop on Ubuntu 20.04

  • Should have a domain name pointing to the public server IP.
  • Nginx installation on your Ubuntu server.
  • An SSL certificate installed for your domain. It will encrypt the user’s information.
  • Also, update the system packages to the latest versions and install the unzip utility, by:
sudo apt update && sudo apt upgrade
sudo apt install unzip

Step 1 - Creating a MySQL Database

1) PrestaShop stores its data in a MySQL database. If MySQL or MariaDB installation is there on your server then skip this step. Otherwise, install the MySQL 5.7 server package. Do it from Ubuntu’s default repositories by using the following command:

sudo apt install mysql-server mysql-client
Note: For fresh MySQL installations, it is recommended to run mysql_secure_installation command. It improves the security of your MySQL server.

2) Now, to create a database, log in to the MySQL shell:

sudo mysql

3) Next, from within the MySQL shell, run the below SQL statement. It will create a new database as prestashop:


4) Now, you need to create a MySQL user account named prestashop and grant necessary permissions to the user. Do it by running the below command:

CREATE USER 'prestashop'@'localhost' IDENTIFIED BY 'change-with-strong-password';
GRANT ALL ON prestashop.* TO 'prestashop'@'localhost';
Note: Do not forget to replace change-with-strong-password with a strong password.

5) After this, exit the MySQL console by typing:


Step 2 - Installing and Configuring PHP

1) PHP 7.4 is the default PHP version in Ubuntu 20.04. It is fully supported as well as a recommendation for PrestaShop. So, run the below command to install PHP and all other necessary PHP modules:

sudo apt install php php-common php-cli php-fpm php-opcache php-gd php-mysql php-curl php-intl php-xsl php-mbstring php-zip php-bcmath php-soap

2) After this installation process is complete, the PHP-FPM service will automatically start. You can verify it by typing:

sudo systemctl status php7.4-fpm

You will see the below output:


php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-03-24 11:53:33 PDT; 14s ago
     Docs: man:php-fpm7.2(8)
 Main PID: 15853 (php-fpm7.2)
   Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"

3) After that, run the below sed commands. It will set the recommended PHP options:

sudo sed -i "s/memory_limit = .*/memory_limit = 1024M/" /etc/php/7.4/fpm/php.ini
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 256M/" /etc/php/7.4/fpm/php.ini
sudo sed -i "s/zlib.output_compression = .*/zlib.output_compression = on/" /etc/php/7.4/fpm/php.ini
sudo sed -i "s/max_execution_time = .*/max_execution_time = 18000/" /etc/php/7.4/fpm/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.4/fpm/php.ini
sudo sed -i "s/;opcache.save_comments.*/opcache.save_comments = 1/" /etc/php/7.4/fpm/php.ini

sudo systemctl restart php7.4-fpm

Step 3 - Download PrestaShop

1) At the time of writing this article, the latest version of PrestaShop is version Download the latest version from the PrestaShop Downloads Page using the below wget command:

cd /tmp

2) After the download is complete, create a directory. It will hold your PrestaShop files:

sudo mkdir -p /var/www/html/

3) Continue to extract the PrestaShop archive:

unzip prestashop_*.zip

4) This archive has another zip file containing all the PrestaShop files. You will then extract the files. Now, extract the files in the domain's document root directory using the following command:

sudo unzip -d /var/www/html/

5) Set correct permissions so that the webserver can have full access to the site’s files and the directories using the belowchown command:

sudo chown -R www-data: /var/www/html

Step 4 - Configuring Nginx

1) You should already have Nginx with an SSL certificate installed on your Ubuntu server. Open your text editor and proceed to create the below file:

sudo nano /etc/nginx/sites-available/

server {

    listen 80;
    listen 443 ssl http2;

    root /var/www/html/;
    index index.php;

    # SSL parameters
    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;
    ssl_trusted_certificate /etc/letsencrypt/live/;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    # Cloudflare / Max CDN fix
    location ~* \.(eot|otf|ttf|woff(?:2)?)$ {
        add_header Access-Control-Allow-Origin *;

    # Do not save logs for these
    location = /favicon.ico {
        auth_basic off;
        allow all;
        log_not_found off;
        access_log off;

    location = /robots.txt {
        auth_basic off;
        allow all;
        log_not_found off;
        access_log off;

    # Images
    rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
    rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
    rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
    rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
    rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
    rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
    rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
    rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
    rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
    rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;

    # AlphaImageLoader for IE and fancybox
    rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;

    # Web service API
    rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

    # Installation sandbox
    rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;

    #Change this block to your admin folder
    location /admin_CHANGE_ME {
        if (!-e $request_filename) {
            rewrite ^/.*$ /admin_CHANGE_ME/index.php last;

    # File security
    # .htaccess .DS_Store .htpasswd etc
    location ~ /\. {
        deny all;
    # Source code directories
    location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
        deny all;
    # Prevent exposing other sensitive files
    location ~ \.(yml|log|tpl|twig|sass)$ {
        deny all;

    # Prevent injection of php files
    location /upload {
        location ~ \.php$ {
            deny all;
    location /img {
        location ~ \.php$ {
            deny all;

    # PHP FPM part
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;

2) Do not forget to replace with your PrestaShop domain. Also, admin_CHANGE_ME with your admin directory. You will then find the directory name by listing the content of the PrestaShop root directory:

sudo ls -l /var/www/html/ | grep admin

3) Remember, to use the correct path to SSL certificate files before restarting the Nginx service. You can check the configuration for syntax errors:

sudo nginx -t

The output will look like this:


nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

4) Link the configuration file sites-enabled and unlink the default page of nginx:

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
sudo unlink /etc/nginx/sites-enabled/default

4) Finally, restart the Nginx service by typing:

sudo systemctl restart nginx

Step 5 - Install PrestaShop

1) Now, after the PrestaShop download is complete and the server configuration is done, you will finish installation via the web interface. Open your browser, and type your domain.

2) You will now select the language you want to use and click on the “Next” button. On the next screen, you will get the PrestaShop license agreement. So, read the license carefully and continue to select I agree to the above terms and conditions to continue:


3) Next, you will see the below information page:


4) Make sure that all pre-installation requirements are met and also that your system is compatible with the PrestaShop.

5) On the next screen, you will need to enter your store details. The email address is the username that will allow you to access the PrestaShop administration backend.

6) After that, you will be asked to enter the database user and connection details that were created by you earlier:


7) Once you click on the “Next” button, the installation will start:


8) The installation will take a few minutes, once it is completed you will get a screen confirming that the PrestaShop has been installed.

9) For security reasons, you will need to delete the installation directory. For this, go back to the terminal and enter the below rm command:

sudo rm -rf /var/www/html/

10) To access your PrestaShop administrative dashboard, click on the “Manage your store” button. Enter your email and password. You will get redirected to the administration dashboard. From here, you will start customizing your PrestaShop installation. Further, you can add new products.

FAQs to Install PrestaShop on Ubuntu 20.04

What are the system requirements for installing PrestaShop on Ubuntu 20.04?

To install PrestaShop, you need a web server (like Apache or Nginx), PHP, a MySQL database, and other dependencies. Ensure your server meets these requirements.

How do I install Apache, PHP, and MySQL on Ubuntu 20.04?

You can install these components using the terminal and the package manager. Use commands like sudo apt install apache2, sudo apt install php, and sudo apt install mysql-server to install them.

What are the recommended file permissions for PrestaShop on Ubuntu 20.04?

Set the appropriate permissions to ensure security. Execute the following command from the PrestaShop installation directory:

sudo chown -R www-data:www-data.

sudo chmod -R 755.

How do I configure PrestaShop on Ubuntu 20.04?

Open your web browser and enter your domain or IP address. Follow the on-screen instructions to configure PrestaShop. Provide the database details you created earlier.

How can I secure my PrestaShop installation on Ubuntu 20.04?

Enable SSL/TLS encryption for your website using a trusted certificate. Regularly update PrestaShop and its modules. Implement strong passwords and enable two-factor authentication.

How can I access the PrestaShop admin panel on Ubuntu 20.04?

To access the PrestaShop admin panel, go to and log in using the credentials you provided during the installation.

Does installing PrestaShop on Ubuntu 22.04 require root access? 

No, installing PrestaShop on Ubuntu 22.04 typically does not require root access. However, some administrative permissions may be required to set up the necessary files, directories, and configurations as specified in the installation documentation.


We hope this detailed tutorial helped you to install PrestaShop on Ubuntu 20.04.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Blog - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.