PrestaShop is a popular and powerful open-source eCommerce platform that allows businesses to create, customize, and manage an online store. It supports multiple payment methods, themes, and modules, making it ideal for creating scalable and professional online shops.
Why Use PrestaShop?
- Wide Range of Features: PrestaShop offers a robust set of features for managing products, orders, and customers.
- Flexibility: With over 3,000 modules and numerous themes available, PrestaShop is highly customizable.
- Multilingual: Support for multiple languages and currencies makes it easy to manage stores serving different markets.
- Payment Gateway Support: Integration with many payment gateways like PayPal, Stripe, and others.
Step 1: Set Up a Cloud Instance
Before we begin the installation process, you’ll need a cloud instance where the FTP server will run. Follow these steps to create one:
Step 1.1: Access Your Provider’s Dashboard
- Log into your hosting provider’s control panel and find the option to create a new instance or server.
Step 1.2: Select Data Center Location
- Choose the data center location that is geographically closest to your users or target audience for optimal performance.
Step 1.3: Configure the Server Plan and Operating System
- Pick the server plan that meets your needs in terms of CPU, memory, and storage.
- Select AlmaLInux 9 as the operating system for the instance.
Step 1.4: Finalize the Instance Creation
- Provide the necessary details like hostname and authentication method (SSH keys or password), then initiate the creation of your instance.
Step 1.5: Locate Your Instance’s IP Address
- After the instance is created, retrieve the public IP address from the instance’s details. This will be needed to connect remotely and configure the server.
Connecting to the Instance
Once your instance is created, follow these steps to connect to it:
- Obtain Your IP Address: After creating the instance, you will be provided with an IP address. Make sure to copy it.
- Use SSH to Connect: Open a terminal (on Linux or macOS) or an SSH client (such as PuTTY for Windows), and run the following command to connect to your AlmaLinux instance:
ssh root@<your-ip-address>
Replace <your-ip-address>
with the actual IP address of your instance.
- Accept the SSH Key: If this is your first time connecting to the instance, you will be prompted to accept the server’s SSH key. Type yes and press Enter.
- Enter Your Password: Input the root password you set when creating the instance.
You should now be logged into your AlmaLinux server and ready to proceed with the PrestaShop installation.
Step 2: Update the System
Start by updating the system packages:
dnf update -y
reboot
Step 3: Install EPEL and Remi Repository
To enable additional PHP versions and packages, install the EPEL and Remi repositories:
dnf install epel-release dnf-utils http://rpms.remirepo.net/enterprise/remi-release-9.rpm
Step 4: Enable PHP 8.2
Reset the default PHP module and enable PHP 8.2 from the Remi repository:
dnf module reset php
dnf module enable php:remi-8.2
Step 5: Install Apache, MariaDB, and PHP with Required Extensions
Install Apache, MariaDB, PHP, and the required PHP extensions for PrestaShop:
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 -y
Step 6: Enable and Start Apache and MariaDB
Enable and start both the Apache and MariaDB services:
systemctl enable httpd
systemctl start httpd
systemctl status httpd
systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb
Step 7: Verify PHP Installation
Verify that PHP and its extensions are correctly installed:
php -v
php -m
Step 8: Configure Firewall
Make sure your firewall allows HTTP and HTTPS traffic by enabling the services and reloading the firewall:
systemctl unmask firewalld
systemctl start firewalld
firewall-cmd --add-service={http,https} --permanent
firewall-cmd --reload
firewall-cmd --list-all
Step 9: Edit PHP Configuration
Edit the PHP configuration file to meet PrestaShop’s requirements:
nano /etc/php.ini
Make the following changes:
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
Restart Apache to apply the changes:
systemctl restart httpd
Step 10: Secure MariaDB Installation
Run the MariaDB security installation script to set up a secure database environment:
mariadb-secure-installation
Log into MariaDB as root to verify it’s working properly:
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;
SHOW GRANTS FOR prestashop@localhost;
QUIT
Step 11: Download PrestaShop
Navigate to the web root and download the PrestaShop package:
cd /var/www/html/
wget https://github.com/PrestaShop/php-ps-info/archive/refs/tags/v1.1.tar.gz
tar -xzvf v1.1.tar.gz
mv php-ps-info-1.1 check-ps
Download PrestaShop:
cd /var/www/
wget https://github.com/PrestaShop/PrestaShop/releases/download/8.1.3/prestashop_8.1.3.zip
unzip prestashop_8.1.3.zip -d /var/www/prestashop
Step 12: Set Correct File Permissions
Ensure that Apache has ownership of the PrestaShop files and assign the appropriate permissions:
chown -R apache:apache /var/www/prestashop
chmod u+rw /var/www/prestashop
Step 13: Configure Apache for PrestaShop
Create a new Apache virtual host configuration for PrestaShop:
nano /etc/httpd/conf.d/prestashop.conf
Add the following configuration:
<VirtualHost *:80>
ServerName example.comt
ServerAdmin contact@example.com
DocumentRoot /var/www/prestashop
<Directory /var/www/prestashop>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/prestashop_error.log
CustomLog /var/log/httpd/prestashop_access.log combined
</VirtualHost>
Test the Apache configuration and restart the service:
apachectl configtest
systemctl restart httpd
Step 14: Secure PrestaShop with Let’s Encrypt SSL
Install Certbot and configure SSL with Let’s Encrypt:
dnf install -y certbot python3-certbot-apache
Run Certbot to obtain and install the SSL certificate:
certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email contact@shape.host -d almalinux.shape.host
Step 15: Access PrestaShop from the Browser
Once you have successfully installed PrestaShop on the server, follow these steps to complete the installation through your browser.
- Open your web browser and navigate to
http://<your-domain-or-ip>/install
(replace<your-domain-or-ip>
with your actual domain name or server IP). You will be greeted by the PrestaShop Installation Assistant. - Choose Your Language: Select your preferred language from the dropdown menu and click Next to proceed.
- License Agreements: Read the PrestaShop license agreement and accept the terms.
- System Compatibility: Ensure that your server environment is compatible with PrestaShop.
- Store Information: Enter your store and administrator details, such as name, email, and password.
- Content of Your Store: Choose whether to install demo products or not.
- System Configuration: Enter your database credentials.
- Store Installation: The PrestaShop installer will now install the necessary components.
- Installation Complete: Once the installation is finished, you will receive your administrator login details for the Back Office. It will show your email and password used for the login. For security reasons, PrestaShop will prompt you to delete the
install
folder. Make sure to follow this step by running the following command to remove the installation folder:
- PrestaShop Dashboard: After logging into the Back Office, you will be taken to the PrestaShop Dashboard. Here, you can manage orders, products, customers, and configure your store as per your requirements.
Important Step: Remove the Install Directory
After completing the installation via the browser, it is critical to delete the installation directory to secure your store. Run the following command to remove the directory:
rm -rf /var/www/prestashop/install
Without removing this directory, your store will remain vulnerable to potential attacks. Make sure to complete this step after finalizing the browser installation.
You have now completed the installation of PrestaShop on AlmaLinux 9. Your online store is now up and running, and you can start configuring it with products, shipping methods, payment gateways, and more. PrestaShop provides powerful tools to help manage your business efficiently, from managing stock to handling customer orders.
For better performance and reliability, consider using Shape.Host‘s Linux SSD VPS services, optimized for hosting demanding eCommerce platforms like PrestaShop. With high-speed SSDs, you can ensure a smooth shopping experience for your customers.