PrestaShop is an open-source e-commerce platform that runs efficiently on AlmaLinux, providing a robust solution for building and managing online stores. Known for its flexibility and extensive range of features, PrestaShop allows users to easily create customizable online shops. The platform supports numerous payment gateways, shipping methods, and marketing tools, enhancing the shopping experience for both merchants and customers. On AlmaLinux, a stable and secure enterprise-grade Linux distribution, PrestaShop benefits from a reliable and high-performance environment. This combination makes it ideal for businesses of all sizes seeking to establish a professional and scalable online presence.

This guide will show you how to install PrestaShop on an AlmaLinux 9 server with the LAMP Stack (Apache/Htppd, MySQL/MariaDB, and PHP). You will also learn how to secure PrestaShop with SSL/TLS certificates from Letsencrypt.

Prerequisites

Before going further, make sure you have the following:

  • An AlmaLinux 9 server.
  • A non-root user with root privileges.
  • A domain name pointed to a server IP address.
  • SELinux with status permissive.

Installing LAMP Stack

First, you need to install package dependencies to run PrestaShop. In this guide, you will run PrestaShop with the LAMP Stack (Apache2/Httpd, MySQL/MariaDB, and PHP). For now, PrestaShop requires at least Apache 2.4, PHP 8.1, and MySQL 5.6.

In this step, you will install LAMP Stack with additional PHP extensions that PrestaShop requires.

Before that, run the command below to enable EPEL and Remi repository for AlmaLinux.

sudo dnf install epel-release dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm

Now run the command below to enable PHP 8.1 via the Remi repository.

sudo dnf module reset php

sudo dnf module enable php:remi-8.2

<img alt="enable remi" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/2-enable-remi-php81.png66a800ca5f361.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="306" loading="lazy" src="data:image/svg xml,” width=”748″>

Install the LAMP Stack package to your AlmaLinux 9 server with the command below.

sudo dnf install httpd mariadb-server php php-curl php-soap php-intl php-zip php-cli php-mysqlnd php-common php-opcache php-memcached php-bcmath php-gd php-mbstring php-xml php-gmp php-imagick

Type y to proceed with the installation.

<img alt="install lamp" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/3-install-lamp.png66a800caadce7.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="310" loading="lazy" src="data:image/svg xml,” width=”750″>

Also, type y to accept the GPG key for the Remi repository.

<img alt="accept gpg key" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/4-accept-key.png66a800cb0b33d.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="165" loading="lazy" src="data:image/svg xml,” width=”750″>

After installation is finished, start and enable both Apache and MariaDB services on your system.

Execute the following command to start and enable the httpd service.

sudo systemctl enable httpd

sudo systemctl start httpd

Then, verify the httpd service to ensure it’s running.

sudo systemctl status httpd

<img alt="verify httpd" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/5-start-enable-httpd.png66a800cb3cabf.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="230" loading="lazy" src="data:image/svg xml,” width=”750″>

As shown in the picture below, the httpd service is running.

Next, start and enable the MariaDB service with the command below.

sudo systemctl enable mariadb

sudo systemctl start mariadb

Once MariaDB is running, verify the mariadb service using the following command.

sudo systemctl status mariadb

You can see the MariaDB service running on your AlmaLinux server.

<img alt="verify mariadb" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/6-start-verify-mariadb.png66a800cb8a24d.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="312" loading="lazy" src="data:image/svg xml,” width=”750″>

Lastly, run the following command to verify the PHP version and list of enabled extensions. Be sure that you have installed PHP 8.1 for PrestaShop installation.

php -v

php -m

<img alt="verify php" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/7-check-php.png66a800cbdc048.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="378" loading="lazy" src="data:image/svg xml,” width=”616″>

Setting Up Firewalld

After installing LAMP Stack, you must open both HTTP and HTTPS services via firewalld. This allows clients to access your PrestaShop installation.

Open the HTTP and HTTPS services on firewalld using the following command.

sudo firewall-cmd --add-service={http,https} --permanent

Now reload firewalld to take effect of your changes.

sudo firewall-cmd --reload

Lastly, verify the list of enabled services and ports in firewalld. Ensure both HTTP and HTTPS services is added to firewalld.

sudo firewall-cmd --list-all

<img alt="setup firewalld" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/8-setup-firewalld.png66a800cc18fa4.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="266" loading="lazy" src="data:image/svg xml,” width=”675″>

Setting Up PHP

In this section, you will set up your PHP installation by editing the default php.ini file. PrestaShop required at least 256 MB memory_limit, and also required the allow_url_fopen to be enabled. So you must modify your php.ini configuration file.

Open the PHP configuration file /etc/php.ini using the following nano editor.

sudo nano /etc/php.ini

Change the default PHP configuration with the following. Be sure to adjust the timezone and memory_limit with your current environment.

date.timezone = Europe/Paris

max_execution_time = 130

memory_limit = 256M

allow_url_fopen = On

allow_url_include = Off

post_max_size = 128M

upload_max_filesize = 128M

max_input_vars = 5000

Save the file and exit the editor when you’re done.

Now run the systemctl command below to restart the httpd service and apply your PHP configuration.

sudo systemctl restart httpd

Setting Up MariaDB Server

Now with PHP configured, move on to the MariaDB server configuration. You will secure your MariaDB server installation, then create a new database and user for PrestaShop.

To secure your MariaDB server installation, execute the command below.

sudo mariadb-secure-installation

When the process starts, you will be asked with some of MariaDB configuration – Input Y to apply the suggested configuration, or type N to reject it:

  • Switch to unix_socket authentication?. Input n and press ENTER. The default MariaDB root user is already protected. optionally, you can also enable it by typing y for yes.
  • Change the root password?. Input y to confirm and set up your new MariaDB root password.
  • Remove anonymous user?. Input y to confirm.
  • Disallow root login remotely? Input y to confirm. Only local connection will be allowed if you are using the MariaDB root user.
  • Remove the test database and access to it?. Input y to confirm and remove the default database ‘test’.
  • Lastly, input y again to reload all tables privileges on your MariaDB server and apply new changes.

After configuring the MariaDB server, you will create a new database and user for PrestaShop.

Log in to the MariaDB server with the command below. Enter your MariaDB root password when prompted.

sudo mariadb -u root -p

Once logged in, execute the following queries to create a new database prestashopdb with user prestashop and password psp4ssw0rd.

CREATE DATABASE prestashopdb;

GRANT ALL PRIVILEGES ON prestashopdb.* TO 'prestashop'@'localhost' IDENTIFIED BY 'psp4ssw0rd';

FLUSH PRIVILEGES;

<img alt="create database and user" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/9-create-db.png66a800cc5f51d.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="135" loading="lazy" src="data:image/svg xml,” width=”750″>

Now run the following query to verify privileges for user prestashop. Be sure that user prestashop has privileges to access the database prestashopdb.

SHOW GRANTS FOR prestashop@localhost;

lastly, type quit to exit from the MariaDB server.

<img alt="verify user" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/10-verify-user.png66a800cc9df43.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="226" loading="lazy" src="data:image/svg xml,” width=”750″>

Checking Environment for PrestaShop Installation

Now that you have configured LAMP Stack, the next step is verifying your PrestaShop environment.

Move to the /var/www/html directory and download the PrestaShop checker using the wget command below. Be sure to grab the latest version of the PrestaShop checker.

cd /var/www/html/

wget https://github.com/PrestaShop/php-ps-info/archive/refs/tags/v1.1.tar.gz

Once downloaded, extract the PrestaShop check source code and rename the extracted directory to check-ps.

tar -xzvf v1.1.tar.gz

mv php-ps-info-1.1 check-ps

Lastly, open your web browser and visit your server IP address followed by the path of PrestaShop checker, such as http://192.168.5.50/check-ps/phppsinfo.php.

Input the default user and password ‘prestashop‘.

<img alt="prestashop checker" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/11-pscheck.png66a800cceb887.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="392" loading="lazy" src="data:image/svg xml,” width=”750″>

From the PrestaShop checker page, ensure that every dependency and system configuration is met with the PrestaShop requirements.

<img alt="prestashop checker" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/12-check-ps.png66a800cd3d7a6.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="573" loading="lazy" src="data:image/svg xml,” width=”750″>

Downloading PrestaShop

In this section, you will download the PrestaShop source code to your AlmaLinux server. You will also set up proper permission and ownership for the PrestaShop source code.

Move to the /var/www directory and download the latest version of PrestaShop using the wget command below. Be sure to check the PrestaShop GitHub page to get the latest stable version of PrestaShop.

cd /var/www/

wget https://github.com/PrestaShop/PrestaShop/releases/download/8.1.3/prestashop_8.1.3.zip

Once downloaded, extract the PrestaShop source code to the /var/www/prestashop directory using unzip command below. This will be used as the document root directory for PrestaShop.

unzip prestashop_8.1.3.zip -d /var/www/prestashop

Now change the ownership and permission of the /var/www/prestashop directory to user apache.

sudo chown -R apache:apache /var/www/prestashop

sudo chmod u rw /var/www/prestashop

Setting Up Httpd Virtual Host

After downloading PrestaShop, you need to create a new httpd virtual host configuration that will be used to run PrestaShop. So be sure that you have your domain name ready before configuring the virtual host.

Create a new httpd virtual host configuration /etc/httpd/conf.d/prestashop.conf using the following nano editor command.

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

Add the configuration below to the file and be sure to change the domain name with your domain.



ServerName howtoforge.local

ServerAdmin [email protected]

DocumentRoot /var/www/prestashop



Options FollowSymlinks

AllowOverride All

Require all granted

ErrorLog /var/log/httpd/prestashop_error.log

CustomLog /var/log/httpd/prestashop_access.log combined

Save and exit the file when you’re done.

Now execute the following command to verify your httpd configuration. If you have proper httpd syntax, you will get an output Syntax OK.

sudo apachectl configtest

<img alt="setup vhost" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/13-vhost.png66a800cd63809.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="172" loading="lazy" src="data:image/svg xml,” width=”592″>

Lastly, run the command below to restart the httpd service and implement your new virtual host configuration. Your PrestaShop installation should now be accessible.

sudo systemctl restart httpd

Setting Up Certbot

Before you start the PrestaShop installation, make sure to generate SSL/TLS certificates, especially for production. This you do easily via Certbot.

Install the certbot and Certbot Apache plugin to your AlmaLinux server with the following command.

sudo dnf install -y certbot python3-certbot-apache -y

Once the installation is complete, generate SSL/TLS certificates for your PrestaShop domain name with the command below. Be sure to change the details domain name and email address in the following command.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d howtoforge.local

With this, your SSL/TLS certificates will be generated to the /etc/letsencrypt/live/domain.com directory. Also, your PrestaShop installation will be automatically configured with HTTPS via the Certbot Apache plugin.

Installation of PrestaShop

Open your web browser and visit your PrestaShop domain name, which is https://howtoforge.local/. If your installation is successful, you will get the PrestaShop installation page.

First, select the default language to English, then click Next.

<img alt="default language" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/15-language.png66a800cdcba7e.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="433" loading="lazy" src="data:image/svg xml,” width=”750″>

Now select Agree to accept the license agreement for PrestaShop and click Next.

<img alt="license agreement" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/15-license.png66a800ce02dfe.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="522" loading="lazy" src="data:image/svg xml,” width=”750″>

Input your Shop name, admin user, password, and email address that will be used as the administrator for your PrestaShop installation. Then, click Next to continue.

<img alt="setup admin" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/16-setup-admin.png66a800ce5e5ff.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="577" loading="lazy" src="data:image/svg xml,” width=”750″>

For store configuration, you can install demo data and click Next.

<img alt="demo data" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/17-demo-store.png66a800ceb9218.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="434" loading="lazy" src="data:image/svg xml,” width=”750″>

Next, input details of your MariaDB database name, user, and password. Then click Next again.

<img alt="setup database" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/18-database-settings.png66a800cf08165.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="535" loading="lazy" src="data:image/svg xml,” width=”750″>

After the installation completes, you will get the configuration like this – You can also see an additional instruction for deleting the PrestaShop install directory:

<img alt="installation complete" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/20-install-complete.png66a800cf58050.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="503" loading="lazy" src="data:image/svg xml,” width=”750″>

PrestaShop homepage.

<img alt="demo shop" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/07/echo/21-test-store.png66a800cf96b70.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="532" loading="lazy" src="data:image/svg xml,” width=”750″>

Back to your terminal and execute the command below to delete the PrestaShop install directory.

rm -rf /var/www/prestashop/install

Lastly, execute the following command to allow reading and writing for PrestaShop directories.

chmod u rw /var/www/prestashop/var/cache

chmod u rw /var/www/prestashop/var/logs

chmod u rw /var/www/prestashop/img

chmod u rw /var/www/prestashop/mails

chmod u rw /var/www/prestashop/modules

chmod u rw /var/www/prestashop/translations

chmod u rw /var/www/prestashop/upload

chmod u rw /var/www/prestashop/download

chmod u rw /var/www/prestashop/app/config

chmod u rw /var/www/prestashop/app/Resources/translations

Conclusion

Congratulations! You have completed the installation of PrestaShop on the AlmaLinux 9 server. You have installed PrestaShop with the LAMP Stack (Apache/Httpd, MySQL/MariaDB, and PHP) and secured PrestaShop with SSL/TLS certificates from Letsencrypt. Now, you can upload your themes and add your products to sell.