How To Install PrestaShop on AlmaLinux 9
In this tutorial, we will show you how to install PrestaShop on AlmaLinux 9. In today’s digital era, e-commerce is booming, and having a solid online presence is a necessity. PrestaShop, an open-source e-commerce platform, offers a powerful solution for businesses of all sizes. By combining PrestaShop with a LAMP (Linux, Apache, MariaDB, PHP) stack on AlmaLinux 9, you can create a secure and efficient online store.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of PrestaShop on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for PrestaShop.
- Bpytop requires certain permissions that can only be granted to a superuser or a user with
sudo
privileges. Ensure that you have the necessary administrative access.
Install PrestaShop on AlmaLinux 9
Step 1. Start by updating your AlmaLinux 9 server to ensure you have the latest software packages and security updates:
sudo dnf clean all sudo dnf update
This command will update your package repository, ensuring that you have the latest software packages and security patches.
Step 2. Installing LAMP Stack on AlmaLinux.
Before we dive into this tutorial, it’s crucial to ensure that your server is equipped with the powerful LAMP stack. If you haven’t already set up LAMP, don’t worry – we’ve got you covered. Just follow our comprehensive guide available right here.
Step 3. Installing PrestaShop on AlmaLinux 9.
To install PrestaShop, you need to retrieve the latest version from their official website. Use the wget
command to download the latest PrestaShop archive:
wget https://github.com/PrestaShop/PrestaShop/releases/download/8.1.2/prestashop_8.1.2.zip
Unzip the downloaded file to your Apache document root directory:
sudo unzip prestashop_8.1.2.zip -d /var/www/html/
Adjust the file permissions for PrestaShop to ensure the web server has access to the files:
sudo chown -R apache:apache /var/www/html/prestashop sudo chmod -R 755 /var/www/html/prestashop
Step 4. Configuring MariaDB.
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. you should read each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Use the MariaDB command-line tool to create a database for PrestaShop:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for PrestaShop installation:
MariaDB [(none)]> CREATE DATABASE presta_db; MariaDB [(none)]> CREATE USER 'presta_user'@'localhost' IDENTIFIED BY 'your-strong-passwd'; MariaDB [(none)]> GRANT ALL ON presta_db.* TO 'presta_user'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
Step 5. Creating a Virtual Host for PrestaShop.
To create a virtual host for PrestaShop, you need to edit the Apache virtual host configuration file. Use a text editor to open the configuration file:
sudo nano /etc/httpd/conf.d/prestashop.conf
Add the following virtual host configuration, replacing yourdomain.com
with your actual domain name:
<VirtualHost *:80> ServerAdmin admin@yourdomain.com DocumentRoot /var/www/html/prestashop ServerName yourdomain.com ServerAlias www.yourdomain.com </VirtualHost>
Save the changes and exit the text editor. Enable the virtual host configuration and restart Apache:
sudo a2ensite prestashop.conf sudo systemctl restart httpd
Step 6. Secure PrestaShop.
Now, let’s set up HTTPS with Certbot. If you haven’t already installed Certbot, you can do so with the following command:
sudo dnf install certbot python3-certbot-apache mod_ssl sudo certbot --apache
Let’s Encrypt SSL certificates have a 90-day validity period. To ensure uninterrupted HTTPS access to your PrestaShop store, you should set up automatic certificate renewal.
Certbot can configure a cron job to automatically renew your certificates when they are close to expiring. Run the following command to enable automatic renewal:
sudo certbot renew --dry-run
Step 7. Configure Firewall.
Before you begin configuring the firewall for PrestaShop, it’s essential to understand the current status of the firewalld service:
sudo systemctl status firewalld
To open ports for services that PrestaShop requires, use the --add-service
or --add-port
commands. For example, if PrestaShop uses HTTP (port 80) and HTTPS (port 443):
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https
To see a list of the active rules, run:
sudo firewall-cmd --list-all
Step 8. Accessing PrestaShop Web UI.
To ensure that your PrestaShop store is functioning correctly, open your web browser and navigate to your domain (e.g., https://yourdomain.com
). You should see your PrestaShop store’s front end.
Congratulations! You have successfully installed PrestaShop. Thanks for using this tutorial for installing the PrestaShop on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official PrestaShop website.