PrestaShop is a popular eCommerce platform that performs exceptionally well on a properly configured VDS (Virtual Dedicated Server). Below is a step-by-step guide to setting up PrestaShop on your VDS.

Server Requirements for PrestaShop

Component Requirement
Operating System Linux (Ubuntu 20.04/22.04, CentOS 7/8, or Debian 10/11)
Web Server Apache 2.4+ or Nginx 1.18+
PHP Version PHP 7.4–8.1 (depending on PrestaShop version)
Database MySQL 5.7+ or MariaDB 10.3+
Disk Space At least 2 GB free (more for larger stores)
Memory Minimum 2 GB RAM (4 GB recommended for better performance)

Prepare Your VDS

Update System Packages

sudo apt update && sudo apt upgrade -y # For Ubuntu/Debian
sudo yum update -y # For CentOS

Install Required Software

  1. Install Apache or Nginx:
    sudo apt install apache2 -y # For Apache
    sudo apt install nginx -y # For Nginx
  2. Install PHP and Extensions:
    sudo apt install php php-cli php-mysql php-curl php-zip php-gd php-xml php-mbstring -y
  3. Install MySQL or MariaDB:
    sudo apt install mysql-server -y # For MySQL
    sudo apt install mariadb-server -y # For MariaDB
  4. Secure the Database Server:
    sudo mysql_secure_installation

Download and Configure PrestaShop

  1. Navigate to the web server root directory:
    cd /var/www/html
  2. Download PrestaShop:
    wget https://download.prestashop.com/releases/prestashop_1.7.8.8.zip
  3. Extract the archive:
    sudo apt install unzip -y
    unzip prestashop_1.7.8.8.zip
    mv prestashop /var/www/html/prestashop

Set Permissions

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

Configure Apache or Nginx

Apache Configuration

  1. Create a new virtual host:
    sudo nano /etc/apache2/sites-available/prestashop.conf
  2. Add the following configuration:
    <VirtualHost *:80>
    ServerName yourdomain.com
    DocumentRoot /var/www/html/prestashop
    <Directory /var/www/html/prestashop/>
    AllowOverride All
    Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/prestashop_error.log
    CustomLog ${APACHE_LOG_DIR}/prestashop_access.log combined
    </VirtualHost>
  3. Enable the site and restart Apache:
    sudo a2ensite prestashop.conf
    sudo systemctl restart apache2

Nginx Configuration

  1. Create a new configuration file:
    sudo nano /etc/nginx/sites-available/prestashop
  2. Add the following:
    server {
    listen 80;
    server_name yourdomain.com;
    root /var/www/html/prestashop;

    index index.php;

    location / {
    try_files $uri /index.php?$query_string;
    }

    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    }
  3. Enable the configuration and restart Nginx:
    sudo ln -s /etc/nginx/sites-available/prestashop /etc/nginx/sites-enabled/
    sudo systemctl restart nginx

Create a Database for PrestaShop

  1. Log in to MySQL:
    sudo mysql -u root -p
  2. Create a database:
    CREATE DATABASE prestashop;
    CREATE USER 'prestashop_user'@'localhost' IDENTIFIED BY 'strongpassword';
    GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop_user'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

Finalize PrestaShop Installation

  1. Open your browser and navigate to:
    http://yourdomain.com
  2. Follow the installation wizard:
    • Enter database details (prestashop_user, prestashop, password).
    • Set your admin account and store details.
  3. After installation, delete the /install directory:
    rm -rf /var/www/html/prestashop/install

Secure Your Installation

  1. Enable HTTPS: Install an SSL certificate (e.g., Let's Encrypt):
    sudo apt install certbot python3-certbot-apache
    sudo certbot --apache -d yourdomain.com
  2. Regular Backups: Automate backups of your database and files using cron or backup tools.

Optimize Performance

  • Enable Caching: Use PrestaShop built-in caching or tools like Redis.
  • Use a CDN: Integrate a CDN (e.g., Cloudflare) for faster content delivery.
  • Optimize Images: Use compressed images to improve load times.

Your PrestaShop is now set up and ready to use on your VDS.