Skip to content

1. Installing PrestaShop on Rocky Linux

Create Rocky Linux image in cPouta, launch an instance based on that image and install PrestaShop on it

Original Author: Sami Koivisto
Last updated by Jesse Anttila
Last checked by Henri Kautto
Version 1.0.1
Lastmod: 28.01.2026
Comments: Removed section about creating a Rocky Linux VM, see prerequisites

Prerequisites#

1. Login, update and reboot the system#

Log in as the rocky user. The first thing you should do on this new, clean VM is to update all installed packages.

sudo dnf update -y
sudo reboot

Wait a moment, then right-click on the top of the PuTTY window and select Restart Session. If the PuTTY window just disappears, make a new connection.

2. Install required packages#

PHP#

Install PHP 7.4 along with the necessary extensions.

Install EPEL and dnf-utils

sudo dnf install epel-release dnf-utils -y

Install Remi repository (to make PHP packages available for installation)

sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm -y

Enable PHP 7.4

sudo dnf module enable php:remi-7.4 -y

Install PHP 7.4 and necessary extensions

sudo dnf install 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 php-process -y

Verify PHP version and extensions

php -v
php -m

Apache#

Install Apache

sudo dnf install httpd -y

Enable Apache

sudo systemctl enable httpd

Start Apache

sudo systemctl start httpd

Confirm that Apache is running

sudo systemctl status httpd

MariaDB#

Install MariaDB

sudo dnf install mariadb-server -y

Enable MariaDB

sudo systemctl enable mariadb

Start MariaDB

sudo systemctl start mariadb

Confirm that MariaDB is running

sudo systemctl status mariadb

CTRL+C


Git#

Install git

sudo dnf install git -y

Editors#

Install nano, vim, or any text editor of your choice. For this setup, we will install Nano

sudo dnf install nano -y

3. Edit PHP configuration file#

sudo nano /etc/php.ini

Find the relevant lines and make the necessary changes (you can search in Nano using CTRL+W). Remember to remove the ; character in front of date.timezone and max_input_vars (; means it is commented out).

date.timezone = Europe/Helsinki
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 and exit using CTRL+S and then CTRL+X

Restart Apache

sudo systemctl restart httpd

4. Secure MariaDB installation & create a database#

sudo mariadb-secure-installation

First, press Enter when prompted for the current password for root. Then, answer Y to every question and proceed to change the root password

Log in to MariaDB as root and enter the password that you set previously

sudo mariadb -u root -p

Proceed to create a database and a database user to use for your PrestaShop installation. Save these details, you will need them later when going through Prestashop installation wizard.

IMPORTANT: Change YOUR_DATABASE_NAME, YOUR_DATABASE_USER and YOUR_DATABASE_PASSWORD to your own values. You need to remember these values!

CREATE DATABASE YOUR_DATABASE_NAME;

GRANT ALL PRIVILEGES
  ON YOUR_DATABASE_NAME.*
  TO 'YOUR_DATABASE_USER'@'localhost'
  IDENTIFIED BY 'YOUR_DATABASE_PASSWORD';

FLUSH PRIVILEGES;

SHOW GRANTS FOR YOUR_DATABASE_USER@localhost;

QUIT

5. Clone PrestaShop from your own GitLab repository#

Navigate to www

cd /var/www

Change URL_TO_REPOSITORY to your actual repository URL, then clone the repository. You may need to provide your GitLab username and password or personal access token

sudo git clone URL_TO_REPOSITORY

6. Give correct file permissions#

Change ownership of the PrestaShop directory to the Apache user

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

Grant read and write permissions to the PrestaShop directory for the owner

sudo chmod u+rw /var/www/YOUR_PRESTASHOP_DIRECTORY

7. Configure Apache#

First, install bind-utils to check your domain

sudo dnf install bind-utils -y

Use nslookup to check your domain

nslookup YOUR_FLOATING_IP

Note down your domain and create a new configuration

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

Add the following configuration and make sure to replace the values for ServerName, ServerAdmin, DocumentRoot, and Directory with your own values

<VirtualHost *:80>
    ServerName YOUR_DOMAIN
    ServerAdmin YOUR_EMAIL
    DocumentRoot /var/www/YOUR_PRESTASHOP_DIRECTORY

    <Directory /var/www/YOUR_PRESTASHOP_DIRECTORY>
        Options +Indexes
        AllowOverride All
        Require all granted
    </Directory>

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

Test Apache configuration

apachectl configtest

Restart Apache

sudo systemctl restart httpd

8. Secure PrestaShop with SSL#

Install Certbot

sudo dnf install -y certbot python3-certbot-apache

Obtain and install the SSL certificate by providing your email address and accepting the Terms of Service (TOS)

sudo certbot --apache -d YOUR_DOMAIN

9. Final steps#

Create a logs directory and grant recursive write permissions to the Apache user

sudo mkdir /var/www/YOUR_PRESTASHOP_DIRECTORY/var/logs
sudo chown -R apache:apache /var/www/YOUR_PRESTASHOP_DIRECTORY/var/logs

Allow Apache to write to the PrestaShop directory by configuring SELinux

sudo chcon -R -t httpd_sys_rw_content_t /var/www/YOUR_PRESTASHOP_DIRECTORY

Allow Apache to make outbound network connections, such as downloading language packs

sudo setsebool -P httpd_can_network_connect on

Go to your website (replace AAA-BBB-CCC-DDD with your floating IP): fip-AAA-BBB-CCC-DDD.kaj.poutavm.fi

  1. Choose your language
  2. Agree terms and conditions
  3. System compatibility should be ok
  4. Provide your store information, enable SSL, and create an account. The email address will be used to access your store's back office
  5. In the system configuration, set the Database server address to localhost. Enter the Database name, login, and password that you provided during the MariaDB secure installation. Test the database connection, and if the connection is successful, proceed with the installation
  6. Install the store
  7. Once the store is installed, if you try to access the admin page and receive a message to remove the "install" folder, navigate to your server directory using cd /var/www/YOUR_PRESTASHOP_DIRECTORY and then run the command sudo rm -r install. After this, you will be able to access the admin page, and your store will be ready to use
  8. HINT: You can find your admin folder's name in YOUR_PRESTASHOP_DIRECTORY by running ls. It should be the first directory listed