PrestaShop provides an efficient and innovative e-commerce solution that suits anyone looking for an easy platform to manage and sell their inventory online. It enables you to create a complete online store, including inventory management, product catalogs, shipping, invoicing, and many more. You can use PrestaShop to run your online stores and build amazing digital experiences with little effort. For more about PrestaShop, please check their Homepage To get started with installing PrestaShop, follow the steps below:

Install Nginx HTTP Server

PrestaShop requires a web server to function, and Nginx is one of the most popular open-source web servers available today. To install Nginx on Ubuntu, run the commands below: After installing Nginx, the commands below can be used to stop, start and enable the Nginx service to always start up with the server boots. To test whether Nginx is installed and functioning, open your web browser and browse to the server’s IP address or hostname. http://localhost If you see the above page in your browser, then Nginx is working as expected.

Install MariaDB Database Server

You’ll also need a database server to run PrestaShop. A database server is where PrestaShop content gets stored. A truly open-source database server that you can use with PrestaShop is the MariaDB database server. It is fast, secure and the default server for almost all Linux servers. To install MariaDB, run the commands below: sudo apt-get install MariaDB-server MariaDB-client After installing MariaDB, the commands below can be used to stop, start and enable the MariaDB service always to start up when the server boots. Next, run the commands below to secure the database server with a root password if you were not prompted to do so during the installation. When prompted, answer the questions below by following the guide.

Enter current password for root (enter for none): Press the Enter Set root password? [Y/n]: Y New password: Enter password Re-enter new password: Repeat password 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

To verify and validate that MariaDB is installed and working, log in to the database console using the commands below: type the root password when prompted. If you see a similar screen as shown above, then the server was successfully installed.

PrestaShop is a PHP-based application, and PHP is required to run it. Since some versions of Ubuntu don’t have the latest version of PHP, you can add a third-party PPA repository to install PHP from there. The command below will add a third-party PPA to Ubuntu. Then update and upgrade to PHP 7.4 Next, run the commands below to install PHP 7.4 and related modules. After installing PHP 7.4, go and configure some basic settings that may be required for PrestaShop to function properly. Run the commands below to open the PHP Below are good settings to configure for most PrestaShop websites. That should get PHP 7.4 installed with some basic settings to allow PrestaShop to function.

Create PrestaShop Database

When all the servers are installed above, it’s now time to begin setting up the PrestaShop environment. First, run the steps below to create a blank database for PrestaShop to use. Login to the MariaDB database console using the commands below: Then create a database called Prestashop Next, create a database user called prestashopuser and set a password Then grant the user full access to the database. Finally, save your changes and exit.

Download PrestaShop

At this point, PrestaShop is ready to be downloaded and installed. Use the commands below to download the latest version of PrestaShop. https://www.prestashop.com/en/download At the time of this writing, the current version is 1.7.6.5. Run the commands below to download it. Then run the commands below to create a PrestaShop directory and extract the downloaded content there. After that, run the commands below to set the correct permissions for PrestaShop to function. Then run the command below to allow the www-data user to own the PrestaShop directory.

Configure Nginx

Below is where you configure the Nginx VirtualHost file for the PrestaShop site you’re creating. This file defines how client requests are handled and processed. Run the commands below to create a new VirtualHost file called Prestashop in the /etc/Nginx/sites-available/ directory. A very good configuration setting for most PrestaShop sites on the Nginx server is below. This configuration should work great. Copy the content below and save it into the file created above. Save the file and exit. After saving the file above, run the commands below to enable the new site, then restart the Nginx server. At this stage, PrestaShop is ready and can be launched by going to the server’s IP or hostname. However, if you want to enable SSL or accept web traffic over HTTPS, then you can continue below to install and configure Let’s Encrypt free SSL certificates.

Install Let’s Encrypt Wildcard Certificates

At step 6, PrestaShop is ready to use without SSL. However, if you want to serve web traffic over HTTPS, then installing and configuring Let’s Encrypt SSL certificate or other public certificates is a must. To install Let’s Encrypt, run the commands below. The commands above will install the certbot tool and all dependencies that will be allowed to make the tool function. Let’s Encrypt provides many ways to challenge you to validate that you own the domain you want to provide SSL certificates for. You will not be able to generate certificates if you can’t prove that you own the domain you want to secure. For wildcard certificates, the only challenge method Let’s Encrypt accepts is the DNS challenge, which we can invoke via the preferred-challenges=dns flag. So, to generate a wildcard cert for domain *.example.com, you run the commands below: The command options above are explained below:

certonly:                                     Obtain or renew a certificate, but do not install –manual:                                    Obtain certificates interactively –preferred-challenges=dns:      Use dns to authenticate domain ownership –server:                                      Specify the endpoint to use to generate –agree-tos:                                 Agree to the ACME server’s subscriber terms -d:                                               Domain name to provide certificates for

After executing the command above, Let’s Encrypt will provide a text string to add a text record to your DNS entry. Example: Go to your DNS provider portal and add a text record for the string above and save. Wait a few mins before continuing from the prompt. Some DNS providers take a wile to propagate changes so it may depend on your provider’s platform. After the changes above and Let’s Encrypt can validate that you own the domain, you should see a successful message as below: The wildcard certificate is now generated and ready to be used. To verify that the certificate is ready, run the commands below: That should display a similar screen as below: Now, Let’s Encrypt’s certificates are valid for 90 days. You’ll want to set up a cron job to automate the renewal process. To do that, open crontab and add the entry below: Then add the line below and save. Save and you’re done! With Let’s Encrypt installed, reopen the Nginx VirtualHost file created above and add Let’s Encrypt configurations to secure your website. Run the commands below and open the file. sudo nano /etc/nginx/sites-available/prestashop Then add the highlighted lines to the VirtualHost file as shown below: After the above, restart Nginx and PHP 7.4-FPM Next, open your browser and browse the server domain name. You should see the PrestaShop setup wizard complete. Please follow the wizard carefully. https://example.com/ The Prestashop installer should begin the setup wizard. Choose the installation language and continue. Accept the licensing terms, validate that all requirements are met, then continue. Next, type in the database name, username, and password created above and continue. After that, your store should be ready. Delete the install folder. That’s it! Conclusion: Congratulation! You have successfully installed PrestaShop on Ubuntu 18.04 | 20.04. If you find any error above, please use the comment form below to report it. Thanks, You may also like the post below: