1. Installing PrestaShop on Rocky Linux
Create Rocky Linux image in cPouta, launch an instance based on that image and install PrestaShop on it
Prerequisites#
- PuTTY (Windows) or Terminal (Linux/macOS)
- CSC project (Create new project and enable cPouta)
- cPouta (Login when cPouta is enabled and active)
- First virtual machine setup guide completed
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.
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
Install Remi repository (to make PHP packages available for installation)
Enable PHP 7.4
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
Apache#
Install Apache
Enable Apache
Start Apache
Confirm that Apache is running
MariaDB#
Install MariaDB
Enable MariaDB
Start MariaDB
Confirm that MariaDB is running
CTRL+C
Git#
Install git
Editors#
Install nano, vim, or any text editor of your choice. For this setup, we will install Nano
3. Edit PHP configuration file#
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
4. Secure MariaDB installation & create a database#
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
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
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
6. Give correct file permissions#
Change ownership of the PrestaShop directory to the Apache user
Grant read and write permissions to the PrestaShop directory for the owner
7. Configure Apache#
First, install bind-utils to check your domain
Use nslookup to check your domain
Note down your domain and create a new configuration
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
Restart Apache
8. Secure PrestaShop with SSL#
Install Certbot
Obtain and install the SSL certificate by providing your email address and accepting the Terms of Service (TOS)
9. Final steps#
Create a logs directory and grant recursive write permissions to the Apache user
Allow Apache to write to the PrestaShop directory by configuring SELinux
Allow Apache to make outbound network connections, such as downloading language packs
Go to your website (replace AAA-BBB-CCC-DDD with your floating IP): fip-AAA-BBB-CCC-DDD.kaj.poutavm.fi
- Choose your language
- Agree terms and conditions
- System compatibility should be ok
- Provide your store information, enable SSL, and create an account. The email address will be used to access your store's back office
- 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
- Install the store
- 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_DIRECTORYand then run the commandsudo rm -r install. After this, you will be able to access the admin page, and your store will be ready to use - HINT: You can find your admin folder's name in
YOUR_PRESTASHOP_DIRECTORYby runningls. It should be the first directory listed