Saturday, April 20, 2024
HomeTutorialsHow to Install and Configure PrestaShop on Linux System

How to Install and Configure PrestaShop on Linux System

If you own a digital or physical store, it is essential to build a web store to sell and show your products over the internet. Creating your e-commerce store using the Prestashop CMS is easy because it doesn’t require any coding or programming skills; you can install it on your system, set your domain, and you are good to go. Prestashop is a free, open-source, and customizable e-commerce content management system (CMS) that you can install on your Linux system.

Many premium themes, plugins, and stock templates will create an e-commerce store easier. Furthermore, the clean UI of the Prestashop CMS can offer your consumers a smooth shopping experience.

Why PrestaShop?


We don’t hear a lot about the Prestashop because the authority doesn’t spend a lot of money on advertising and publicity as it is free. But once you start using the Prestashop, you will love it. It might be true that there are more massive e-commerce builders like Shopify or Woocommerce that you can use to grow your business.

The reason you would choose Prestashop is, it is free and free and open-source. You can see every single line of the source code and customize it according to your need. Moreover, the Prestashop has many modules and a rich backend that gives you an adequate monitoring system for your site.

Foss PrestaSHOP

Besides, on an e-commerce site, there will be a transaction of cash, order, and shopping; these processes require a secure server that you can rely on. Prestashop offers you to build your own server if you want. Further, you can configure VISA, American Express, Mastercard, and Paypal payment methods on Prestashop for your customers.

PrestaShop on Linux System


To configure the Prestashop on a Linux system, we will need to install a web server, database, and PHP framework on our system. Here, I will use the Apache server, MySQL Database, to configure the Prestashop.

You can use Nginx server and PostgreSQL, or any other DB engine or SQL tool to configure Prestashop. Most importantly, to install the Prestashop on your system, you need to have a domain to live your site. Here, I will use the localhost address to illustrate the process.

In this post, you will see how to install Prestashop on Ubuntu/Debian and Fedora (Red Hat-based) Linux systems and configure it with a domain to get started with a web store. For Debian distributions, I will use the Apache2 PHP service, MySQL as a LAMP stack. And for Fedora Linux, I will use the httpd services and MariaDB.

Step 1: Install Database Engine on Linux


Creating a database for a PHP server is essential to configure our file system with the server. You can also use the phpMyAdmin service to configure your database with your server. Here, we will see how to install a DB engine on Ubuntu and Fedora Linux and create a Prestashop database.

1. Install DB Engine on Ubuntu/Debian


Installing Prestashop requires a database engine, so I will now install the MySQL DB engine and create a database for the Prestashop CMS. You can run the following aptitude command on your terminal shell to get the MySQL on your Ubuntu Linux.

apt install mysql-client-core-8.0
sudo apt install mysql-server mysql-client

Prestashop on Linux SQL

2. Install DB Engine on Fedora Linux


We will use the MariaDB on our Fedora Linux machine to configure a database with the Prestashop CMS. If you are a Fedora or Red Hat-based Linux user, you can run the following YUM command-line on your terminal shell to install the MariaDB on your system.

sudo yum install mariadb mariadb-server

After installing the DB engine, you may now run the following system control commands to start and enable the MariaDB services on your Linux system.

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

MariaDB on Fedora

You can now run the following command on your terminal shell to customize and secure your database engine secure.

sudo /usr/bin/mysql_secure_installation

Step 2: Create Database for PrestaShop


Once the installation of the DB engine is done, you can now create a database for Prestashop. Creating a database is easy; you just need to run a few SQL commands on your shell. First, you have to log into your DB engine and create a database for Prestashop. Run the following command and enter your password to get started with the SQL services.

mysql -u root -p

Now, run the following SQL command to create a database. You should remember your server address and the password that you’re using for SQL. Here, the DB password is assigned after the IDENTIFIED BY syntax, don’t forget to replace the change-with-strong-password with your password.

CREATE DATABASE prestashop;
GRANT ALL ON prestashop.* TO 'prestashop'@'localhost' IDENTIFIED BY 'change-with-strong-password';
EXIT;

Step 3: Install PHP Server on Linux


In this step, we will see how you can Install a PHP server on your Linux system. We will use the Apache PHP server on our system to configure the Prestashop CMS. We will install the Apache2 services on Debian Linux and httpd services on Fedora Linux to get started with the PHP server.

1. Install Apache on Ubuntu Linux


Installing the Apache server on a Debian-based system is straightforward. You can run the following aptitude command-line given below with root privileges on your terminal shell to run the Apache server.

sudo apt install apache2

After installing the Apache server, you may now check your firewall settings and allow the PHP server to use your internet access. Ubuntu users can run the following UFW commands to allow the Apache server on their network.

sudo ufw allow 'Apache'

apache and UFW on Ubuntu

2. Install httpd on Fedora Linux


Fedora and other Red Hat-based Linux use the httpd service to run the Apache PHP server. You can run the following YUM command on your shell to install the httpd services on your Fedora Linux.

sudo yum install httpd

Now run the system control commands given below to start and enable the PHP server.

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

If you have trouble running your PHP server, make sure you have allowed the HTTP port through the firewall setting.

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

Now, run the following system control commands to enable and restart the Apache services on your Linux system.

sudo systemctl status apache2
sudo systemctl enable apache2

Step 4: Configure PHP for PrestaShop


As Prestashop CMS requires some additional PHP modules to run on a Linux system, we will install the PHP common, PHP XML, PHP CLI, and a few other modules on our system. Here, we will learn how to set up a domain or a localhost address and the database with a server.

1. Configure PHP on Debian/Ubuntu Linux


If you are a Ubuntu user, you can run the following aptitude command given below on your terminal shell to get the PHP modules on your system. The command will install MySQL, XML, and other modules for the PHP framework.

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

Prestashop on Linux PHP modules

Now run the following command on your terminal shell to edit the PHP configuration script. You can edit and customize the maximum file upload size, expand memory limit, setup time zone, and other configuration parameters through the php.ini file.

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

The following PHP settings would be perfect for getting started with the Prestashop on a Linux system.

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

Prestashop on PHP INI

Now, run the following shell command to add your domain address on the sites -available configuration. Here, I am using the localhost (127.0.0.1) address as my domain, and you can replace it with your domain.

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

You can use the following script to configure your domain for the Apache server on your Linux system. After adding the script save the file and exit the text editor.

<VirtualHost *:80>
ServerName 127.0.0.1
DocumentRoot /var/www/prestashop/

<directory> /var/www/prestashop/>
allowoverride all
allow from all
</directory>
</VirtualHost>

prestashop apache server edit

Now, restart your PHP server to see the effects.

sudo /etc/init.d/apache2 restart

2. Configure PHP on Fedora Linux


After installing the httpd server, you can now configure the server parameters by running the command given below on your terminal shell. As shown in the picture below, you need to allow the override permission for your server’s filesystem.

sudo nano /etc/httpd/conf/httpd.conf

Once the configuration script opens, edit the script according to your setting. Here is a sample PHP configuration script that you can follow.

<Directory />
AllowOverride All
Require all denied
<Directory>

You must also configure the ServerName parameter and put your own server address. You can follow the method of configuring the server address for Ubuntu that I have shown earlier.

Prestashop on Fedora HTTPD conf

To configure the PHP server for the Prestashop CMS on your Fedora Linux, run the following command and install the PHP modules on your system.

sudo yum install php php-gd php-mbstring php-mcrypt php-mysqli php-curl php-xml php-cli

You can now install the phpMyAdmin on your system to customize your server’s parameters and address. Install phpMyAdmin and change your server’s configuration.

Install phpMyAdmin on Linux.

yum install phpmyadmin

Run the following command to configure the phpMyAdmin settings.

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

Sample configuration script of phpMyAdmin for a Linux system.

<Directory /usr/share/phpMyAdmin/>
# AddDefaultCharset UTF-8

# <IfModule mod_authz_core.c>
# # Apache 2.4
# <RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
# </RequireAny>
# </IfModule>
# <IfModule !mod_authz_core.c>
# # Apache 2.2
# Order Deny,Allow
# Deny from All
# Allow from 127.0.0.1
# Allow from ::1
# </IfModule>
Require all granted
</Directory>

After configuring the PHP server, you can now integrate your database with your server. To configure your PHP server with your database, run the following command on your terminal shell.

sudo yum install php php-mysql

Now, restart your PHP server on your Linux system.

sudo systemctl restart httpd.service

Step 5: Download PrestaShop for Linux


As we will download the compressed version of the Prestashop CMS, so downloading will be an easy step. After downloading, you need to know where to keep the unzipped files and get ownership access over the Prestashop files. Let’s see how to download and use the Prestashop files for PHP server configuration.

1. Download PrestaShop on Debian/Ubuntu Linux


Downloading PrestaShop is not a hard task; you can either run the following wget command on your Linux terminal shell, or you can click here to download the latest compressed version of Prestashop.

wget https://download.prestashop.com/download/releases/prestashop_1.7.1.1.zip

wget prestashop on Linux

When the download finishes, you can now move the file inside the /var/www directory of your Linux filesystem.

mv prestashop_1.7.1.1.zip /var/www

We will now create a new directory to unzip the compressed Prestashop file. Run the following cd command to create a new directory.

cd /var/www
/var/www# mkdir prestashop

Prestashop Download

Now, unzip the compressed file inside the newly created Prestashop directory. If you don’t have any compression tool installed on your Linux system, you can install the Unzip tool.

sudo apt install unzip

Now, Run the following command-lines on your terminal shell to extract the Prestashop file inside the /var/www/prestashop directory.

/var/www# unzip prestashop_1.7.1.1.zip -d prestashop
/var/www# cd prestashop/
/var/www/prestashop# unzip prestashop.zip

When the unzipping finishes, you may now run the following chown commands to gain root access over the Prestashop directory.

/var/www/prestashop# chown -R www-data. ./
/var/www/prestashop# chmod -R 775 ./

Directory on Ubuntu

After configuring the Prestashop directories, you can now run the following command-lines given below to disable all other PHP sites and enable the Prestashop sites on your system.

disable and enable presta sites

cd /var/www/prestashop/
/var/www/prestashop# a2dissite 000-default.conf
/var/www/prestashop# a2ensite presta.conf
/var/www/prestashop# a2enmod rewrite

Then restart your Apache server.

/var/www/prestashop# systemctl restart apache2

2. Download PrestaShop on Fedora Linux


Downloading the Prestashop on Red Hat-based Linux is similar to Debian distributions. Run the following wget command to download the compressed Prestashop. Then extract the zip file and move the file inside the Prestashop directory.

cd ~
wget https://www.prestashop.com/download/old/prestashop_1.6.1.5.zip

Unzip the PrestaShop zip file.

sudo yum install unzip
unzip prestashop_1.6.1.5.zip

Now, create a folder for Prestashop inside the /var/html/ directory, and move the files inside the directory.

cd /var/www
/var/www# mkdir prestashop
sudo chown -R apache: ~/prestashop/
sudo mv ~/prestashop/* /var/www/html/

Step 6: Install PrestaShop on Linux


Till now, we have seen how to configure PHP server, database and download the Prestashop CMS. Now, we will install the Prestashop CMS on our Linux system. Installing Prestashop on Fedora Linux is not much different from installing it on Debian distributions. This step will be the same for all Linux distributions.

First, open your web browser and type your server address, then hit the Enter button. As we have used the localhost address as the server, we will use the following URL to open the installation page.

https://127.0.0.1/install/

Prestashop on Linux localhost

Once the installation page is opened, select your database, enter the database credentials, and move to the next step.

DB and localhost setting

Then configure the server address and set other settings. Finally, you will reach the finishing point of installing the Prestashop on your Linux system.

About shop

Extra Tip: Install PrestaShop Via cPanel


If you already own a domain and a hosting, you are probably familiar with the concept of installing applications via the Softaculous library. Almost every cPanels support Softaculous, and you can install the PrestaShop CMS on your existing or new domain via the Softaculous library function.

prestashop on cp

To install the PrestaShop via the cPanel, you need to go to the Softaculous Apps Installer function from your cPanel. Then you need to select the E-commerce category, which will take you to the e-commerce application area. Now you can scroll to find the Prestashop application, then click on the install button to install Prestashop on your domain.

You can now provide your domain, database, file manager, and other administrative information to finish the installation process. After the installation is successful, you will find an administrative URL to login to your new Prestashop site.

Prestashop on web

Final Words


Prestashop is a blessing for the e-commerce industry. Despite opening your web store via Prestashop, you can also make money by using your Prestashop skills to setup other’s shops. In the entire post, I have described what Prestashop is and why you should use it. I have elaborately described how you can install, configure, and get started with Prestashop and launch your e-commerce web store.

Please share it with your friends and the Linux community if you find this post useful and informative. You can write to us with your opinions regarding this post in the comment section.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

You May Like It!

Trending Now