How to Install PrestaShop with LAMP Stack on Ubuntu 22.04

PrestaShop is a popular open-source e-commerce platform built with PHP and MySQL/MariaDB.

Prerequisites

  • An Ubuntu 22.04 VPS
  • A user with sudo privileges
  • Basic knowledge of Linux commands

Update Your System

sudo apt update && sudo apt upgrade -y

Install Apache

sudo apt install apache2 -y
sudo systemctl enable --now apache2
sudo systemctl status apache2

Install MySQL/MariaDB

sudo apt install mariadb-server mariadb-client -y
sudo systemctl enable --now mariadb
sudo mysql_secure_installation

Create a database and user for PrestaShop:

sudo mysql -u root -p

Inside the MySQL shell:

CREATE DATABASE prestashop_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'prestashop_user'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON prestashop_db.* TO 'prestashop_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Install PHP and Required Extensions

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

Check PHP version:

php -v

Restart Apache:

sudo systemctl restart apache2

Download PrestaShop

cd /tmp
wget https://github.com/PrestaShop/PrestaShop/releases/download/8.2.0/prestashop_8.2.0.zip -O prestashop.zip
sudo apt install -y unzip
unzip prestashop.zip -d prestashop
sudo mv prestashop /var/www/html/prestashop

Set Permissions

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

Configure Apache Virtual Host (Optional)

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

Paste:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/prestashop
    ServerName yourdomain.com
    <Directory /var/www/html/prestashop/>
        Options +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 and rewrite module:

sudo a2ensite prestashop.conf
sudo a2enmod rewrite
sudo systemctl reload apache2

Access PrestaShop Installer

Open your browser and navigate to:

http://your-server-ip/prestashop

images

Follow the web-based installer:

  1. Choose your language.

images

  1. Accept license agreements.

images

images

images

  1. Enter database credentials:
Database Name: prestashop_db
Login: prestashop_user
Password: strongpassword

images

  1. Complete the installation.

Secure Your Installation

After installation, remove the /install directory:

sudo rm -rf /var/www/html/prestashop/install

images

images

images

(Optional) Change permissions back if needed:

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

Access Your Store

  • Frontend → http://your-server-ip/prestashop
  • Admin → http://your-server-ip/prestashop/adminXXXX (random folder created by installer)

Summary

You now have PrestaShop running on Ubuntu 22.04 with a LAMP stack (Apache, MariaDB, PHP).
For production:

  • Use HTTPS with Let’s Encrypt
  • Enable firewall for HTTP/HTTPS ports
  • Regularly backup database and files
  • Optimize PHP and Apache settings for performance

CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS