PrestaShop Deployment Guide

    Complete installation on RamNode VPS with Ubuntu 22.04/24.04 LTS and LAMP stack

    LAMP Stack
    E-Commerce
    PHP 8.x
    MySQL
    1

    Introduction

    PrestaShop is a powerful, open-source e-commerce platform that enables businesses to create professional online stores. With over 300,000 active stores worldwide, PrestaShop offers extensive customization options, a vast marketplace of modules, and robust multi-language and multi-currency support.

    This guide provides step-by-step instructions for deploying PrestaShop on a RamNode VPS running Ubuntu with the LAMP stack (Linux, Apache, MySQL, PHP).

    2

    Prerequisites

    Before beginning the installation, ensure you have the following:

    ComponentMinimumRecommended
    PHP Version8.18.2 or 8.3
    MySQL/MariaDB5.7 / 10.48.0 / 10.11
    RAM2GB4GB+
    Storage20GB SSD50GB+ SSD

    Note: You'll also need root or sudo access, a registered domain pointed to your server IP, and basic familiarity with Linux command line.

    3

    Server Preparation

    Begin by connecting to your RamNode VPS via SSH and updating the system packages.

    Update System Packages

    Update system
    sudo apt update && sudo apt upgrade -y

    Configure Hostname

    Set hostname
    sudo hostnamectl set-hostname prestashop-server
    sudo nano /etc/hosts

    Add your server IP and domain:

    /etc/hosts
    127.0.0.1     localhost
    YOUR_IP       yourdomain.com prestashop-server

    Configure Firewall

    UFW configuration
    sudo ufw allow OpenSSH
    sudo ufw allow 80/tcp
    sudo ufw allow 443/tcp
    sudo ufw enable
    sudo ufw status
    4

    Installing LAMP Stack

    Install Apache Web Server

    Apache installation
    sudo apt install apache2 -y
    sudo systemctl enable apache2
    sudo systemctl start apache2

    Enable required Apache modules:

    Enable modules
    sudo a2enmod rewrite headers ssl expires deflate
    sudo systemctl restart apache2

    Install MySQL Server

    MySQL installation
    sudo apt install mysql-server -y
    sudo systemctl enable mysql
    sudo mysql_secure_installation

    During secure installation, set a strong root password and answer Y to all security questions.

    Install PHP and Required Extensions

    PHP installation
    sudo apt install php php-mysql php-curl php-gd php-intl \
    php-mbstring php-xml php-zip php-bcmath php-soap     \
    php-cli php-common libapache2-mod-php -y

    Configure PHP for PrestaShop

    Edit PHP config
    sudo nano /etc/php/8.3/apache2/php.ini

    Update the following values:

    php.ini settings
    memory_limit = 512M
    upload_max_filesize = 64M
    post_max_size = 64M
    max_execution_time = 300
    max_input_time = 300
    max_input_vars = 10000
    date.timezone = America/Chicago
    Restart Apache
    sudo systemctl restart apache2
    5

    Database Configuration

    Create a dedicated database and user for PrestaShop:

    Access MySQL
    sudo mysql -u root -p
    SQL commands
    CREATE DATABASE prestashop CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'prestashop_user'@'localhost' IDENTIFIED BY 'YourSecurePassword123!';
    GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop_user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

    Important: Replace 'YourSecurePassword123!' with a strong, unique password. Store this password securely as you will need it during PrestaShop installation.

    6

    Installing PrestaShop

    Download PrestaShop

    Download and extract
    cd /var/www
    sudo wget https://github.com/PrestaShop/PrestaShop/releases/download/8.2.0/prestashop_8.2.0.zip
    sudo apt install unzip -y
    sudo mkdir prestashop
    sudo unzip prestashop_8.2.0.zip -d prestashop/

    Extract Installation Archive

    Extract archive
    cd prestashop
    sudo unzip prestashop.zip
    sudo rm prestashop.zip

    Set File Permissions

    Set permissions
    sudo chown -R www-data:www-data /var/www/prestashop
    sudo find /var/www/prestashop -type d -exec chmod 755 {} \;
    sudo find /var/www/prestashop -type f -exec chmod 644 {} \;
    7

    Configure Apache Virtual Host

    Create virtual host
    sudo nano /etc/apache2/sites-available/prestashop.conf
    prestashop.conf
    <VirtualHost *:80>
        ServerName yourdomain.com
        ServerAlias www.yourdomain.com
        DocumentRoot /var/www/prestashop
    
        <Directory /var/www/prestashop>
            Options -Indexes +FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/prestashop_error.log
        CustomLog ${APACHE_LOG_DIR}/prestashop_access.log combined
    </VirtualHost>
    Enable site
    sudo a2ensite prestashop.conf
    sudo a2dissite 000-default.conf
    sudo systemctl reload apache2
    8

    SSL Certificate with Let's Encrypt

    Secure your store with a free SSL certificate from Let's Encrypt:

    Install Certbot
    sudo apt install certbot python3-certbot-apache -y
    sudo certbot --apache -d yourdomain.com -d www.yourdomain.com

    Follow the prompts to complete SSL setup. Certbot will automatically configure Apache for HTTPS and set up auto-renewal.

    Verify auto-renewal
    sudo certbot renew --dry-run
    9

    Post-Installation Security

    Open your browser and navigate to your domain to complete the PrestaShop installation wizard. After installation, perform these critical security steps:

    Remove Installation Directory

    Remove install folder
    sudo rm -rf /var/www/prestashop/install

    Rename Admin Directory

    Rename the admin folder to a unique, hard-to-guess name:

    Rename admin
    sudo mv /var/www/prestashop/admin /var/www/prestashop/admin-$(openssl rand -hex 4)

    Note the new admin directory name and use it to access your back office.

    Secure Configuration Files

    Secure config
    sudo chmod 400 /var/www/prestashop/app/config/parameters.php
    10

    Performance Optimization

    Enable OPcache

    OPcache config
    sudo nano /etc/php/8.3/apache2/conf.d/10-opcache.ini
    opcache.ini
    opcache.enable=1
    opcache.memory_consumption=256
    opcache.interned_strings_buffer=16
    opcache.max_accelerated_files=10000
    opcache.revalidate_freq=0
    opcache.fast_shutdown=1

    Apache Performance Settings

    Add inside the VirtualHost block:

    Apache performance
    # Enable Gzip Compression
    <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/css
        AddOutputFilterByType DEFLATE application/javascript application/json
    </IfModule>
    
    # Browser Caching
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType image/jpg "access plus 1 year"
        ExpiresByType image/png "access plus 1 year"
        ExpiresByType text/css "access plus 1 month"
        ExpiresByType application/javascript "access plus 1 month"
    </IfModule>

    PrestaShop Cache Settings

    In the PrestaShop back office, navigate to Advanced Parameters → Performance and enable:

    • Smarty Cache: Yes
    • Cache Type: File System
    • CCC (Combine, Compress, Cache): Enable all options
    • Disable non-PrestaShop modules: Yes (if not needed)
    11

    Backup Strategy

    Implement regular backups to protect your store data.

    Database Backup Script

    Create backup script
    sudo nano /opt/backup-prestashop.sh
    backup-prestashop.sh
    #!/bin/bash
    BACKUP_DIR=/var/backups/prestashop
    DATE=$(date +%Y%m%d_%H%M%S)
    
    # Create backup directory
    mkdir -p $BACKUP_DIR
    
    # Database backup
    mysqldump -u prestashop_user -p'YourSecurePassword123!' prestashop | \
    gzip > $BACKUP_DIR/db_$DATE.sql.gz
    
    # Files backup
    tar -czf $BACKUP_DIR/files_$DATE.tar.gz /var/www/prestashop
    
    # Remove backups older than 7 days
    find $BACKUP_DIR -type f -mtime +7 -delete
    
    echo "Backup completed: $DATE"
    Schedule backup
    sudo chmod +x /opt/backup-prestashop.sh
    sudo crontab -e

    Add daily backup at 2 AM:

    Cron entry
    0 2 * * * /opt/backup-prestashop.sh >> /var/log/prestashop-backup.log 2>&1

    Troubleshooting

    🎉 Congratulations!

    Your PrestaShop store is now deployed and ready on your RamNode VPS. Remember to regularly update PrestaShop and its modules to maintain security and access new features.

    For additional support, consult the official PrestaShop documentation at docs.prestashop-project.org or reach out to RamNode support for server-related inquiries.