Introduction

PrestaShop is an open-source e-commerce platform used to build online stores. This tutorial will guide you through the process of installing PrestaShop with Apache and Let's Encrypt SSL on Debian 12.

Prerequisites

Before you begin, ensure you have:

  1. A Debian 12 server
  2. SSH access to the server (optional)
  3. Root or sudo privileges

Step 1: Install Apache and PHP

Update the package index and install Apache and PHP:

sudo apt update
sudo apt install -y apache2 php libapache2-mod-php php-mysql php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip

Step 2: Install MariaDB

Install MariaDB, a MySQL database server:

sudo apt install -y mariadb-server

Step 3: Secure MariaDB

Run the MySQL secure installation script:

sudo mysql_secure_installation

Step 4: Create a MariaDB Database and User

Log in to the MySQL shell and create a database and user for PrestaShop:

sudo mysql -u root -p
CREATE DATABASE prestashopdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'prestashopuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON prestashopdb.* TO 'prestashopuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Download and Extract PrestaShop

Download the latest version of PrestaShop from the official website:

wget https://download.prestashop.com/download/releases/prestashop_1.7.8.5.zip

Unzip the PrestaShop archive:

sudo apt install unzip
unzip prestashop_1.7.8.5.zip -d /var/www/html/

Step 6: Set Permissions

Adjust the ownership and permissions of the PrestaShop files:

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Step 7: Configure Apache

Create a new Apache configuration file for PrestaShop:

sudo nano /etc/apache2/sites-available/prestashop.conf

Add the following configuration:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/
    ServerName your_domain.com
    ServerAlias www.your_domain.com

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

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the PrestaShop site and Apache rewrite module:

sudo a2ensite prestashop.conf
sudo a2enmod rewrite

Restart Apache for the changes to take effect:

sudo systemctl restart apache2

Step 8: Complete the Installation

Open a web browser and navigate to your PrestaShop installation URL (e.g., http://your_domain.com). Follow the on-screen instructions to complete the installation. Provide the database information, shop details, and create an admin account.

Step 9: Install Let's Encrypt SSL

Install Certbot, the Let's Encrypt client:

sudo apt install -y certbot python3-certbot-apache

Obtain an SSL certificate for your domain:

sudo certbot --apache -d your_domain.com -d www.your_domain.com

Follow the prompts to generate the SSL certificate and enable HTTPS for your PrestaShop site.

Conclusion

Congratulations! You have successfully installed PrestaShop with Apache and Let's Encrypt SSL on Debian 12. You can now configure and customize your online store using PrestaShop.

Was this answer helpful? 0 Users Found This Useful (0 Votes)