How to install PrestaShop on Ubuntu 20.04 Server

Learn the simple steps to install and setup the Prestashop e-commerce platform on Ubuntu 20.04 or 18.04 LTS Linux server running on localhost or cloud hosting such as AWS, Google, DigitalOcean, etc.

PrestaShop is an open-source and free to use e-commerce platform that has been written in PHP and suitable to all size of business those want their products to be sold online. However, the appropriate developer and support are necessary.

This free e-commerce platform is available in two versions community and premium that is hosted and managed by the developers itself.  The hosting is provided IONOS. Well, for those who want to host the Prestashop own their own cloud hosting platforms, and have technical knowledge; the community edition is good to go. Whereas, all functions and modules which are not free, you have to purchase them for a fee. Also, the pre-build modules help a lot to extend the functions of Prestashop as required. Therefore, you don’t have to spend any money on features that you don’t need in the end.

The PrestaShop is quite flexible that’s why it gives the user the choice to opt between numerous themes, modules, and extensions, even if the number cannot keep up with giants like Magento.

The e-commerce platform is ideal for small shops and startups desire to open online e-store but at relatively low investment but in a very quick way.

System Requirements to install Prestashop on Ubuntu

  • Ubuntu 20.04 or 18.04 Linux server with root access
  • Prestashop setup files
  • Web server: Apache or Nginx
  • PHP 5.6+ with  extensions: Mcrypt, OpenSSL, Zip, Curl, GD, PDO and memory_limit to “128M” and upload_max_filesize to “16M”
  • MySQL 5.0+

Access your Ubuntu 20.04 Server

If you are on the cloud then simply login and access the terminal using SSH. Or use the local command terminal to do the same.  Well, if you are installing Prestashop on a locally installed Linux server or desktop then you would already be there.

Now, first, run the system update and upgrade commands:

sudo apt update
sudo apt upgrade

Install Apache and MySQL

You can use Nginx, however, here we are using the command on popular web server Apache to show this tutorial along with Mysql Database.

sudo apt install apache2

Enable Apache mod_rewrite module 

sudo a2enmod rewrite
sudo systemctl restart apache2

Install MySQL server

sudo apt install mysql-server

 

Get and Install PHP

The latest version of the PHP available on Ubuntu 20.04 LTS by default is v7.4 which could be different depending on when you are performing this tutorial. However, no need to worry about that. Just simply run the below command and the system will install the available supported version of PHP along with other key extensions we need to setup PrestaShop.

sudo apt install php php-cli php-common php-curl php-zip php-gd php-mysql php-xml php-mbstring php-json php-intl

InstallPHP and all its extensions

Now, change the memory and upload file limits. 

To find the path of your php.ini file run the below command:

php -i | grep -i php.ini

Now, see the path and use it to edit the php.ini file

In our case it was:

sudo nano /etc/php/7.4/cli/php.ini

Command to find the PHP INi path

Find two lines:

Change memory_limit value to 128M

memory_limit= 128M

Change php memory limit for Prestashop

And also increase the upload size of the file to 16 MB or 32 MB, as per your requirements.

upload_max_filesize = 32M

Increase the upload file size for Prestashop

Finally, restart the apache

sudo systemctl restart apache2

Download PrestaShop

The latest version of the PrestaShop while performing this tutorial was v1.7.6.8. Thus, here we are downloading the same. Here is the Github page link to get the latest release.

cd /tmp
wget https://github.com/PrestaShop/PrestaShop/releases/download/1.7.6.8/prestashop_1.7.6.8.zip

Unzip and move Prestashop to www folder

After downloading the latest version of the PrestaShop, unzip it and move the folder to the webroot directory of the webserver. So, that it could be used safely for calling through a web browser.

sudo unzip prestashop_*.zip -d /var/www/html/prestashop/

Note: If you don’t have an unzip tool, then install it using the command:sudo apt install unzip

Change Permission to Apache user

Change the permission of Prestashop folder to Apache’s www-data user and group, for that the syntax will be:

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

Secure MySQL Installation

If you are installing the Prestashop on localhost then you can skip this step, however, for those want it to use for commercial purposes, it is recommended to run the below command and follow the instructions. This will remove the demo database, force the admin to set a strong password for the MySQL server and turn off the remote access of MySQL to secure it.

sudo mysql_secure_installation

Create Database

sudo mysql

Note:presta_h2s is the database here and prestauser is the user and the password is the password we used for the database user. Change them as per your choice.

Create Database

create database `presta_h2s`;

Create User with password

create user 'prestauser'@'localhost' identified by 'password';

Grant all permissions of Database to User

GRANT ALL PRIVILEGES ON `presta_h2s`.* to `prestauser`@localhost;

exit;

 

Configure PrestaShop virtual Host for Apache

In case you are planning to use multiple domains on your Apache webserver then creating a virtual host for Prestashop will be a great idea. This will also let us use our domain for accessing the front-end and backend of the PrestaShop without showing the directory in which we have kept its all files. Therefore create a new Apache configuration file and enable make it.

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

Copy-paste the following lines in the file and save it by using Ctrl+X and type Y and hit the Enter key.

Note: change the your_example.com, the domain you want to use for PrestaShop.

<VirtualHost *:80>
ServerAdmin [email protected]_example.com
ServerName your_example.com
ServerAlias www.your_example.com
DocumentRoot /var/www/html/prestashop

<Directory /var/www/html/prestashop>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>

ErrorLog /var/log/apache2/prestashop-error_log
CustomLog /var/log/apache2/prestashop-access_log common
</VirtualHost>

Enable the Prestashop Apache configuration and restart the webserver.

sudo a2ensite prestashop.conf

sudo systemctl reload apache2

Access your Ecommerce Store

Everything is ready and it’s time to access our Ubuntu 20.04 or 18.04 installed PrestaShop eCommerce store for further settings. Open the browser on your local system and type the Ip address or domain.com pointing to the store.

http://ip-address

http://your_domain.com

Select the Language

Choose the language in which you want to install the PrestaShop and then select the Next button.

Prestashop Installer

Accept the License

Accepth the license

Information about your Store

Provide the information to be used with the store you want to create such as Shop name, main category, country, time zone, and others.

Set store Information of Ecommerce

Connect Database

The database we have created in this article, enter the details of that or any remote database you want to use with your PrestaShop installation.

configuring Database Prestashop

Wait for a few minutes, once done you will be able to access the installed Ecommerce portable.

Presta backend login details

Login to PrestaShop BackEnd

To login to the backend, just type admin at the end of your PrestaShop e-commerce URL. For example http://www.domain.com/admin or http://ip-address/admin

But as we tried to log in, an error will appear “For security reasons, you can not connect to the back office until you have- deleted the Install folder”

To delete the install folder run the below command on the server:

sudo rm -r /var/www/html/prestashop/install

PrestaShop Login error

After deleting the folder, simply refresh the login page, and this time you will get the login page.

Enter login details

PrestaShop Install on Ubuntu 20.04 ot 18.04 LTS Linux

Comments (5)

  1. Pedro Tomás May 19, 2021
    • Heyan May 20, 2021
  2. joão cardoso July 3, 2021
  3. joão cardoso July 3, 2021
  4. joão cardoso July 3, 2021

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.