RHEL BasedRocky Linux

How To Install PrestaShop on Rocky Linux 10

Install PrestaShop on Rocky Linux 10

PrestaShop has established itself as one of the most powerful and flexible open-source e-commerce platforms available today. Businesses worldwide rely on PrestaShop to create robust online stores that drive revenue and customer engagement. When combined with Rocky Linux 10, you’re pairing a best-in-class shopping cart system with a rock-solid, enterprise-grade operating system that delivers stability, security, and exceptional performance.

Rocky Linux 10 represents the modern approach to Linux server management. This community-driven distribution provides long-term support, regular security updates, and binary compatibility with industry-standard enterprise systems. For e-commerce professionals and business owners launching their first online store, this combination offers unmatched reliability. Whether you’re migrating from another platform, starting fresh, or managing multiple PrestaShop installations, this guide walks you through every essential step.

The installation process might seem daunting at first glance. However, following this comprehensive tutorial will simplify the complexity into manageable, logical steps. You’ll understand not just what to do, but why each action matters for your store’s security, performance, and longevity. By the end of this guide, your PrestaShop installation will be production-ready, optimized, and secured according to industry best practices.

This guide assumes you have root access or sudo privileges on a fresh Rocky Linux 10 server. Whether you’re using a dedicated server, virtual private server (VPS), or cloud instance, these instructions apply universally to the Rocky Linux 10 environment.

Table of Contents

Understanding System Requirements and Prerequisites

Before diving into the installation process, confirming your server meets all necessary specifications ensures a smooth, trouble-free deployment. PrestaShop has specific requirements that guarantee optimal functionality and performance across all features.

Server Hardware Specifications

Your server’s hardware forms the foundation of your PrestaShop installation’s capability. Minimum requirements include at least 1.5GB of RAM and 1-2 CPU cores. However, for production e-commerce environments handling real customer transactions, 2GB RAM and 2-4 CPU cores provide much better performance headroom.

Disk space represents another critical consideration. PrestaShop’s base installation requires approximately 500MB of storage. The database grows substantially as you add products, customer records, and order history. Reserve at least 5GB of free disk space initially. High-traffic stores with extensive product catalogs may require 20GB or more over time.

Required Software Stack Components

PrestaShop runs on what’s commonly called the LAMP stack: Linux, Apache, MariaDB, and PHP. Rocky Linux 10 provides the foundation. Apache 2.4 or later serves your website files. MariaDB 10.2 or MySQL 5.7 manage your database. PHP 8.3 or 8.4 executes PrestaShop’s core functionality.

Specific PHP extensions are mandatory for PrestaShop operation. You’ll need curl for downloading resources, gd for image manipulation, mbstring for character encoding, mysqlnd for database connectivity, xml and dom for parsing, zip for archive handling, intl for internationalization, bcmath for calculations, json for data format handling, and opcache for performance enhancement.

Network and Domain Requirements

Ensure you have a registered domain name pointed to your server’s IP address. Control panel access to modify DNS records is necessary. Your firewall must allow traffic on ports 80 (HTTP) and 443 (HTTPS). SSL/TLS certificates—either from Let’s Encrypt or a certificate authority—are strongly recommended, particularly for processing sensitive customer payment information.

Pre-Installation Setup and Server Configuration

A properly configured server environment prevents installation headaches and security vulnerabilities. These preparatory steps take just minutes but provide substantial long-term benefits.

Updating Your Rocky Linux 10 System

Begin by updating all existing system packages to their latest versions. This ensures you have the most recent security patches and bug fixes. Open your terminal and execute the system update command.

sudo dnf update -y

This command instructs the DNF package manager to update all packages silently. The -y flag automatically answers yes to any prompts. Allow this process to complete fully. It typically takes 2-5 minutes depending on your internet connection speed and the number of available updates.

After the update completes, verify the operation succeeded by checking the system version and confirming no errors appeared in the output.

Configuring Firewall Rules for Web Services

Rocky Linux 10 includes firewalld, a sophisticated firewall management system. You must explicitly allow HTTP and HTTPS traffic for your PrestaShop store to be accessible online.

Start by checking your current firewall status:

sudo firewall-cmd --state

This command returns either “running” or “not running.” If firewall-cmd isn’t installed, install it using:

sudo dnf install firewalld -y

Open the HTTP service permanently:

sudo firewall-cmd --permanent --add-service=http

Then add HTTPS service access:

sudo firewall-cmd --permanent --add-service=https

Reload the firewall to apply these changes immediately:

sudo firewall-cmd --reload

Verify your rules took effect:

sudo firewall-cmd --list-services

You should see both http and https in the output. This configuration persists across system reboots due to the --permanent flag.

Understanding and Configuring SELinux

SELinux (Security-Enhanced Linux) provides advanced security controls. For initial installation simplicity, many administrators set it to permissive mode. This allows PrestaShop to function while logging potential security issues.

Check your current SELinux status:

sudo getenforce

To set permissive mode temporarily:

sudo setenforce 0

For permanent configuration, edit the SELinux configuration file:

sudo nano /etc/selinux/config

Locate the line containing SELINUX= and change it to:

SELINUX=permissive

Save the file (Ctrl+X, then Y, then Enter in nano). This change takes effect after the next system reboot. For production environments, configuring SELinux policies properly provides superior security benefits over disabling it entirely. However, that process requires advanced expertise and falls beyond the scope of this guide.

Installing and Configuring the LAMP Stack

The LAMP stack represents the triumvirate of web technologies upon which PrestaShop depends. Each component plays a specific role in delivering your e-commerce functionality.

Installing Apache Web Server

Apache remains the most widely-used web server globally. Its flexibility, extensive module ecosystem, and mature codebase make it ideal for hosting PrestaShop.

Install Apache using DNF:

sudo dnf install httpd -y

Once installed, enable it to start automatically at system boot:

sudo systemctl enable httpd

Then start the Apache service:

sudo systemctl start httpd

Verify Apache is running correctly:

sudo systemctl status httpd

The output should display “active (running).” Test basic functionality by opening your server’s IP address in a web browser. You should see the default Apache welcome page.

Installing MariaDB Database Server

MariaDB is the open-source database engine that stores all PrestaShop data. It’s fully compatible with MySQL, offering excellent performance and reliability.

Install MariaDB:

sudo dnf install mariadb-server -y

Enable it for automatic startup:

sudo systemctl enable mariadb

Start the service:

sudo systemctl start mariadb

Verify MariaDB is running:

sudo systemctl status mariadb

Now secure your MariaDB installation by running the security script:

sudo mysql_secure_installation

This interactive script guides you through several security questions. When prompted for the root password, press Enter (no password is set initially). For all subsequent prompts, answer “y” to:

  • Set root password
  • Remove anonymous users
  • Disable root login remotely
  • Remove test database
  • Reload privilege tables

Choose a strong root password—use uppercase, lowercase, numbers, and special characters.

Installing PHP and Required Extensions

PHP serves as PrestaShop’s engine, executing all shopping cart functionality. Install the core PHP package:

sudo dnf install php -y

Now install all required PHP extensions in a single command:

sudo dnf install php-cli php-fpm php-curl php-gd php-mbstring php-mysqlnd php-xml php-dom php-zip php-intl php-bcmath php-json php-opcache -y

Each extension serves a specific function. The cli extension provides command-line access. The fpm extension enables FastCGI processing for Nginx compatibility. The curl extension downloads remote resources. The gd extension handles image manipulation for product thumbnails. The mbstring extension properly processes international characters. The mysqlnd extension connects to your database.

Verify PHP installation:

php -v

This displays your installed PHP version. Confirm you have PHP 8.3 or later.

Check that all required extensions loaded:

php -m

You should see all the extensions you just installed in the list.

Configuring PHP for PrestaShop Operation

PrestaShop requires specific PHP configuration settings. Locate your php.ini file:

sudo nano /etc/php.ini

Find and modify these settings. Use Ctrl+F to search within nano:

Memory Limit (search for memory_limit):

memory_limit = 256M

Execution Time (search for max_execution_time):

max_execution_time = 130

Upload Settings (search for post_max_size and upload_max_filesize):

post_max_size = 128M
upload_max_filesize = 128M

Input Variables (search for max_input_vars):

max_input_vars = 5000

File Operations (search for allow_url_fopen):

allow_url_fopen = On

Disable URL Includes (search for allow_url_include):

allow_url_include = Off

Character Encoding (search for default_charset):

default_charset = "UTF-8"

After making changes, save the file and restart Apache:

sudo systemctl restart httpd

Testing Your LAMP Installation

Create a simple test file to verify everything works together:

sudo nano /var/www/html/test.php

Add this content:

<?php
phpinfo();
?>

Save the file. Open your browser and navigate to http://your-server-ip/test.php. You should see detailed PHP information. Scroll through the page to confirm all required extensions appear in the list.

After verification, delete this test file:

sudo rm /var/www/html/test.php

Creating PrestaShop Database and User Account

PrestaShop requires a dedicated database and database user. Following the principle of least privilege, this user should have permissions only for PrestaShop’s database, not system-wide access.

Accessing MariaDB and Creating the Database

Connect to MariaDB:

sudo mysql -u root -p

Enter your MariaDB root password when prompted. At the MariaDB prompt, create a database with UTF-8 support:

CREATE DATABASE prestashop_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Use a descriptive name rather than “prestashop_db” if managing multiple installations.

Creating a Dedicated Database User

Still within MariaDB, create a user account:

CREATE USER 'prestashop_user'@'localhost' IDENTIFIED BY 'your-strong-password-here';

Replace the password with a complex one containing uppercase, lowercase, numbers, and symbols.

Grant this user permissions on the PrestaShop database:

GRANT ALL PRIVILEGES ON prestashop_db.* TO 'prestashop_user'@'localhost';

Apply these changes immediately:

FLUSH PRIVILEGES;

Exit MariaDB:

EXIT;

Verifying Database Access

Test the new user’s access:

mysql -u prestashop_user -p prestashop_db

Enter the password you created. If the connection succeeds, you see the MariaDB prompt again. Type EXIT; to close the connection.

Downloading and Preparing PrestaShop Files

With your server properly configured, you’re ready to obtain and deploy PrestaShop files.

Downloading the Latest PrestaShop Release

Visit the official PrestaShop GitHub releases page to find the latest stable version. As of this guide’s writing, PrestaShop 9 represents the current stable release. Download it to your server:

cd /tmp
wget https://github.com/PrestaShop/PrestaShop/archive/refs/tags/9.0.1.zip

Adjust the version number if a newer release is available. Alternatively, use curl:

curl -L -o prestashop_9.0.1.zip https://github.com/PrestaShop/PrestaShop/archive/refs/tags/9.0.1.zip

Extracting PrestaShop Files

If unzip isn’t installed, install it first:

sudo dnf install unzip -y

Extract the PrestaShop archive:

unzip prestashop_9.0.1.zip

This creates a directory containing PrestaShop files. Move these to your web root:

sudo mv prestashop/* /var/www/html/

If installing in a subdirectory:

sudo mkdir -p /var/www/html/prestashop
sudo mv prestashop/* /var/www/html/prestashop/

Setting Correct File Ownership and Permissions

Apache must own all PrestaShop files. Change ownership:

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

Set directory permissions:

sudo find /var/www/html/prestashop -type d -exec chmod 755 {} \;

Set file permissions:

sudo find /var/www/html/prestashop -type f -exec chmod 644 {} \;

Allow Apache to write to essential directories:

sudo chmod -R 755 /var/www/html/prestashop/var
sudo chmod -R 755 /var/www/html/prestashop/app/config
sudo chmod 755 /var/www/html/prestashop/app/config/

Configuring Apache Virtual Host

Apache needs specific instructions for serving PrestaShop. A virtual host configuration provides these instructions.

Creating the Virtual Host Configuration

Create a new Apache configuration file:

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

Add this configuration:

<VirtualHost *:80>
    ServerAdmin admin@yourdomain.com
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/html/prestashop

    <Directory /var/www/html/prestashop>
        Options FollowSymLinks
        AllowOverride All
        Require all granted

        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . /index.php [L]
        </IfModule>
    </Directory>

    ErrorLog /var/log/httpd/prestashop_error.log
    CustomLog /var/log/httpd/prestashop_access.log combined
</VirtualHost>

Replace yourdomain.com with your actual domain and /var/www/html/prestashop with your installation path.

Enabling Necessary Apache Modules

PrestaShop requires mod_rewrite for clean URLs. Enable it:

sudo a2enmod rewrite

Also enable mod_deflate for content compression:

sudo a2enmod deflate

Testing Apache Configuration

Validate your Apache configuration:

sudo httpd -t

The output should display “Syntax OK.” If errors appear, review your configuration file for typos.

Applying Configuration Changes

Restart Apache to apply changes:

sudo systemctl restart httpd

Verify the restart succeeded:

sudo systemctl status httpd

Running the PrestaShop Installation Wizard

With your server fully configured, you’re ready to run PrestaShop’s interactive installer.

Accessing the Installation Interface

Open your web browser and navigate to your domain or server IP address. You should see the PrestaShop installer welcome page. If you receive a connection error, verify your firewall rules and domain DNS settings.

Progressing Through Installation Steps

License Agreement: Read the Open Software License terms and click the acceptance checkbox. PrestaShop operates under a flexible open-source license allowing both commercial and personal use.

Install PrestaShop on Rocky Linux 10

System Compatibility Check: The installer verifies your system meets all requirements. All items should display green checkmarks. If any appear red, return to the relevant configuration section and address the missing requirement.

Store Configuration: Enter your store name, select your primary country, choose your store’s main language, and specify your business type. These settings remain editable later.

Administrator Account: Create a secure admin username and strong password. This account accesses your PrestaShop admin panel for managing products, orders, and configurations.

Database Information: Enter the database name, username, and password you created earlier. Set the database host as “localhost.” Verify the connection succeeds before proceeding.

Installation: PrestaShop creates database tables, installs modules, and generates configuration files. This process typically takes 2-5 minutes. Don’t refresh the page during this step.

Installation Completion

Upon successful completion, you receive confirmation. The installer prompts you to delete the installation folder. This step is critical for security.

Post-Installation Security and Optimization

Your PrestaShop installation is now active but requires essential security hardening.

Removing the Installation Directory

The installer creates an install directory for the setup process. This directory must be deleted immediately to prevent unauthorized access:

sudo rm -rf /var/www/html/prestashop/install

Securing Your Installation

Change ownership of the admin directory:

sudo chmod 750 /var/www/html/prestashop/admin

Rename your admin folder to something obscure:

sudo mv /var/www/html/prestashop/admin /var/www/html/prestashop/admin_unique_name_12345

Update your bookmarks to access the admin panel at the new path.

Creating Automated Backups

Database backups protect against data loss. Create a backup script:

sudo nano /home/backup_prestashop.sh

Add this content:

#!/bin/bash
BACKUP_DIR="/home/prestashop_backups"
DB_NAME="prestashop_db"
DB_USER="prestashop_user"
DB_PASSWORD="your-password"
DATE=$(date +%Y%m%d_%H%M%S)

mkdir -p $BACKUP_DIR
mysqldump -u $DB_USER -p$DB_PASSWORD $DB_NAME > $BACKUP_DIR/prestashop_$DATE.sql
tar -czf $BACKUP_DIR/prestashop_files_$DATE.tar.gz /var/www/html/prestashop

Make it executable:

sudo chmod +x /home/backup_prestashop.sh

Schedule daily backups using cron:

sudo crontab -e

Add this line (runs daily at 2 AM):

0 2 * * * /home/backup_prestashop.sh

Performance Optimization for Your Store

A fast store converts more customers. These optimizations enhance speed significantly.

Enabling PHP OPcache

OPcache caches compiled PHP code, dramatically reducing execution time. Verify it’s enabled:

php -i | grep opcache

Configuring Caching in PrestaShop

Access your PrestaShop admin panel. Navigate to Shop Parameters > Performance. Enable:

  • File cache
  • Smarty cache
  • MySQL caching (if available)
  • CSS and JavaScript compression

Database Optimization

Regular database maintenance improves query performance. Create a maintenance script:

sudo mysql -u prestashop_user -p prestashop_db -e "OPTIMIZE TABLE \`*\`;"

Schedule this weekly via cron:

0 3 * * 0 sudo mysql -u prestashop_user -p your-password prestashop_db -e "OPTIMIZE TABLE \`ps_*\`;"

Implementing Image Optimization

Optimize product images to reduce load times:

sudo dnf install ImageMagick -y

Images should be properly compressed before uploading to PrestaShop.

Troubleshooting Common Installation Issues

Despite careful preparation, issues sometimes occur. These solutions address common problems.

Database Connection Errors

Problem: Installation fails during database configuration.

Solution: Verify MariaDB is running:

sudo systemctl status mariadb

Confirm credentials are correct by testing them manually:

mysql -u prestashop_user -p prestashop_db

Check firewall isn’t blocking port 3306 (if database is remote):

sudo firewall-cmd --permanent --add-port=3306/tcp
sudo firewall-cmd --reload

Missing PHP Extensions

Problem: Installation reports missing required extensions.

Solution: Reinstall missing extensions. For example, if gd is missing:

sudo dnf install php-gd -y
sudo systemctl restart httpd

Verify installation:

php -m | grep gd

File Permission Errors

Problem: Installation fails with permission denied errors.

Solution: Ensure Apache owns all files:

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

Make directories writable:

sudo chmod -R 755 /var/www/html/prestashop

Memory Limit Exceeded

Problem: Installation stops or times out during database import.

Solution: Increase PHP memory limit in php.ini:

sudo nano /etc/php.ini

Find memory_limit and increase to 512M or higher:

memory_limit = 512M

Restart Apache:

sudo systemctl restart httpd

Also increase max_execution_time:

max_execution_time = 300

SSL Certificate Issues

Problem: HTTPS connections fail after SSL installation.

Solution: Verify certificate files exist:

sudo ls -la /etc/letsencrypt/live/yourdomain.com/

Check Apache SSL module is enabled:

sudo a2enmod ssl

Add SSL configuration to your virtual host:

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/yourdomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.com/privkey.pem

Restart Apache:

sudo systemctl restart httpd

Ongoing Maintenance and Update Strategy

Continuous maintenance ensures security and optimal performance.

Applying System Updates

Check for available updates monthly:

sudo dnf check-update

Install security updates immediately:

sudo dnf update -y

Schedule automatic updates for non-critical packages:

sudo dnf install dnf-automatic -y
sudo systemctl enable dnf-automatic.timer
sudo systemctl start dnf-automatic.timer

Updating PrestaShop

Access your admin panel regularly to check for PrestaShop updates. Back up your database and files before updating:

/home/backup_prestashop.sh

Update through the admin panel at Advanced Parameters > System Updates > PrestaShop Updates.

Monitoring Server Health

Check disk usage regularly:

df -h /var/www/html/prestashop

Monitor database size:

sudo mysql -u prestashop_user -p prestashop_db -e "SELECT \`TABLE_NAME\`, ROUND(\`DATA_FREE\` / 1024 / 1024) AS \`Free Space (MB)\` FROM INFORMATION_SCHEMA.TABLES WHERE \`TABLE_SCHEMA\` = 'prestashop_db';"

Implementing Security Monitoring

Enable Apache access logs review:

sudo tail -f /var/log/httpd/prestashop_access.log

Watch error logs for issues:

sudo tail -f /var/log/httpd/prestashop_error.log

Congratulations! You have successfully installed PrestaShop. Thanks for using this tutorial for installing PrestaShop open source e-commerce platform on your Rocky Linux 10 system. For additional help or useful information, we recommend you check the official PrestaShop website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button