In this article, we will have explained the necessary steps to install and configure PrestaShop on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo
privileges. All the commands in this tutorial should be run as a non-root user.
PrestaShop is a free shopping cart platform written in the PHP programming language with support for the MySQL database management system. PrestaShop is used to build and run an online store and it is very easy to use. If you’re looking for an enterprise-grade online store platform to sell your products, PrestaShop should probably be a starting point for you.
Install PrestaShop on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade
Step 2. Install LAMP Stack.
PrestaShop is built with PHP. You can host it like you would any other web app is written in PHP. So, you’re going to need to set Ubuntu up as either a LAMP server. If you haven’t done so already, use our traditional LAMP guide.
Step 3. Download and Install PrestaShop on the Ubuntu system.
We will download the latest stable version of PrestaShop:
cd /tmp wget https://download.prestashop.com/download/releases/prestashop_1.7.7.3.zip
After downloading the latest version of the PrestaShop, unzip it and move the folder to the webroot directory of the webserver:
sudo unzip prestashop_*.zip -d /var/www/html/prestashop/
After that, 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/
Step 4. Creating a MariaDB database for PrestaShop.
PrestaShop uses the MariaDB database to store all its data. Log in to your MariaDB server with the following command and enter your MariaDB root password:
mysql -u root -p
Once you’re in the MariaDB console, create a new database:
MariaDB > CREATE DATABASE prestashop; MariaDB > GRANT ALL ON prestashop.* TO 'prestashop'@'localhost' IDENTIFIED BY 'strong-password'; MariaDB > FLUSH PRIVILEGES; MariaDB > exit;
Step 4. Configuring Apache for PrestaShop.
Create a new virtual host configuration file for your PrestaShop website, named your-domain.com.conf:
nano /etc/apache2/sites-available/domain.com.conf
And add the following content to the file:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/prestashop/ ServerName your-domain.com ServerAlias www.domain.com.conf ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <Directory /var/www/html/prestashop/> Options FollowSymlinks AllowOverride All Require all granted </Directory> </VirtualHost>
To enable the virtual host we have just created, run the following command:
ln -s /etc/apache2/sites-available/domain.com.conf /etc/apache2/sites-enabled/domain.com.conf
For the new configuration to take effect, restart the Apache service by typing:
sudo a2ensite domain.com.conf sudo a2enmod rewrite sudo systemctl restart apache2
Step 5. Completing the PrestaShop Installation.
You can now open your favorite web browser and enter the domain, you should see PrestaShop setup wizard complete. Please follow the wizard carefully.
http://domain.com.
That’s all you need to do to install PrestaShop on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on the PrestaShop e-commerce platform, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.