PrestaShop is a powerful open-source e-commerce platform that allows you to create and manage your online store. In this guide, we will walk you through the installation of PrestaShop on Debian 11, using Apache as the web server and securing it with a free Let's Encrypt SSL certificate. Whether you're deploying it on a local server or using a Windows VPS UK, this tutorial will cover everything you need to get started.
Step 1: Update Your System
Before installing PrestaShop, ensure your system is up to date. Run the following commands:
sudo apt update && sudo apt upgrade -y
Keeping your system updated is crucial for security and performance, whether you're setting it up locally or on a VPS Windows Servers platform.
Step 2: Install Apache, MySQL, and PHP
PrestaShop requires a web server, a database, and PHP. Install Apache, MySQL, and the required PHP extensions by running:
sudo apt install apache2 mysql-server php php-mysqli php-curl php-xml php-gd php-mbstring php-zip php-soap php-intl -y
After installation, enable and start the Apache and MySQL services:
sudo systemctl enable apache2
sudo systemctl start apache2
sudo systemctl enable mysql
sudo systemctl start mysql
Step 3: Configure MySQL Database
Log in to MySQL to create a database and user for PrestaShop:
sudo mysql -u root -p
Create a database and user with the following commands:
CREATE DATABASE prestashop_db;
CREATE USER 'prestashop_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON prestashop_db.* TO 'prestashop_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace your_password
with a secure password of your choice.
Step 4: Download PrestaShop
Navigate to the web root directory and download the latest version of PrestaShop:
cd /var/www/html
sudo wget https://download.prestashop.com/download/releases/prestashop_1.7.8.5.zip
Extract the downloaded file:
sudo unzip prestashop_1.7.8.5.zip
Move the extracted files to the desired directory:
sudo mv prestashop/* .
Remove the empty directory and the zip file:
sudo rmdir prestashop
sudo rm prestashop_1.7.8.5.zip
Step 5: Set Permissions
Set the proper permissions for the PrestaShop files:
sudo chown -R www-data:www-data /var/www/html/*
sudo chmod -R 755 /var/www/html/*
Step 6: Configure Apache for PrestaShop
Create a new Apache configuration file for PrestaShop:
sudo nano /etc/apache2/sites-available/prestashop.conf
Add the following configuration, replacing your-domain.com
with your actual domain:
ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html
ServerName your-domain.com
ServerAlias www.your-domain.com
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/prestashop_error.log
CustomLog ${APACHE_LOG_DIR}/prestashop_access.log combined
Enable the new site and the required Apache modules:
sudo a2ensite prestashop.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Step 7: Secure Apache with Let's Encrypt SSL
To secure your PrestaShop installation with HTTPS, use Let's Encrypt. Install Certbot:
sudo apt install certbot python3-certbot-apache -y
Obtain and install the SSL certificate:
sudo certbot --apache -d your-domain.com -d www.your-domain.com
Certbot will automatically configure SSL for your PrestaShop instance, ensuring secure access to the platform, whether it is hosted locally or on a Windows VPS hosting UK.
Step 8: Complete the Installation
Open your web browser and navigate to http://your-domain.com
or https://your-domain.com
. You will be greeted by the PrestaShop installation wizard. Follow the on-screen instructions to complete the installation process, including setting up your database connection using the credentials created earlier.