PrestaShop is an open-source and free-to-use e-commerce platform that provides an efficient and innovative e-commerce solution that suits anyone looking for an easy platform to manage and sell their products online. To some extent, it is similar to WordPress but Prestashop is used for eCommerce only. You can install Prestashop on Ubuntu 20.04 from any cloud services or VPS provider directly from their marketplace with one-click install. But, in this tutorial, I am going to explain how to install Prestashop on Ubuntu AWS EC2 instance step-by-step.
So, let’s get started.
Prerequisites
- Ubuntu 20.04
- LAMP stack installed. If not, follow this article to install LAMP on Ubuntu.
- Domain name with SSL installed (optional). You can install PrestaShop on IP also.
Install PrestaShop on Ubuntu EC2 instance
I am assuming that you have already launched an EC2 instance. Now, you have to connect to the EC2 instance via SSH to continue installation.
Step 1: Connect Ubuntu Server via SSH
Login to the EC2 instance and update the software packages.
ssh -i “Server_Key.pem” ubuntu@"IP_Address"
Server_Key: Your server key with PEM extension if you are using Ubuntu or Mac.
If you are using a Windows machine to access the EC2 instance, use (PPK) file in PuTTY client. Click here to know “how to convert PEM to PPK”.
IP_Address: EC2 instance IP Address.
Step 2: Download Recommended PHP extensions
It is recommended to install the following PHP extensions for the PrestaShop installation.
sudo apt install php7.4-fpm php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip
and also modify PHP INI file in editor by following command.
sudo vi /etc/php/7.4/fpm/php.ini
Add the update the following values on PHP INI file.
file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 256M
cgi.fix_pathinfo = 0
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago
To search any word on Vi editor, follow the below steps
Type “/” and the “word” to search. E.g. /file_uploads then hit the Enter on the keyboard. It will highlight the searched word and press N for finding the next occurrence of the same word. For more Vi shortcuts click here.
Step 3: Create Database for PrestaShop
Create a database by login to MySQL console by following command.
mysql -u root -p
Type your MySQL password and hit Enter on the Keyboard. On MySQL console, run following command to create a database for Prestashop.
mysql> CREATE DATABASE prestashopDb;
mysql> exit;
Step 4: Download PrestaShop from the Official Site
Now it’s time to download PrestaShop from the official website by following command. First change the directory to temp.
cd /tmp
wget https://download.prestashop.com/download/releases/prestashop_1.7.7.4.zip
sudo unzip prestashop_1.7.7.4.zip
If unzip not installed on the server, you can install unzip on Ubuntu by following command.
sudo apt install unzip
Now, again run the unzip command to extract the prestashop file.
After unzipping PrestaShop, move the files to the web server(Apache) document root by following command.
sudo unzip prestashop.zip -d /var/www/html
After moving the files to the document root, correct the permission of PrestaShop files and directory. To change permission and set ownership, run the following commands.
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
Also, enable apache rewrite module by running the following command.
sudo a2enmod rewrite
After changing the permission and ownership, restart apache server to effect changes.
sudo systemctl restart apache2
Step 5: Install PrestaShop on Ubuntu
Open google chrome or any browser to continue with the installation. When you hit the server IP on the browser, it will show an installation page. Choose the installation language and click on Next.
Accept the agreement and click on Next to continue the installation. After accepting the agreement, it’s time to fill-up the form with store details and click on Next to continue. Now, you will be asked to provide database details. Fill up the database details and check the database connection by clicking on “Test your database connection now”. If you provide correct database details, it will show “Database is connected”.
If database connection is successful, click on the Next to continue.
PrestaShop installer script will install all the database tables, modules, themes, etc to finalize the installation.
It will take a few minutes or may be less to complete the installation. When installation completes, it will show the password to login to the backend of the store.
Hurray, you have successfully installed PrestaShop on your server. Now delete the install folder from the document root for security purposes. You can delete the “install” directory by the following command.
sudo rm -r /var/www/html/install
Awesome, you have successfully deleted the “install” folder to secure your server.
Access Prestashop admin panel by following link
server_ip/admin_directory_name
As PrestaShop change the “admin” directory name for security purpose. To find the renamed admin directory name, go to the document root by following command.
cd /var/www/html
ls
it will show the files inside document root.
look at the directory, “admin” directory is renamed as “admin568o3ohpz”.
In our case, PrestaShop admin login URL will be
serverIP_or_domainname/admin568o3ohpz
Conclusion
In this tutorial, you have learned to install PrestaShop on Ubuntu Server. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.