Skip to main content

Command Palette

Search for a command to run...

PrestaShop Installation on AWS - Complete Step-by-Step Guide

Project Overview

Updated
7 min read
PrestaShop Installation on AWS - Complete Step-by-Step Guide

Deploy PrestaShop on AWS Free Tier with separate application and database servers.

Phase 1: Launch EC2 Instances

Step 1: Launch Application Server

  1. Navigate to AWS ConsoleEC2Launch instance
  1. Configure instance:

    • Name: prestashop-app-server

    • AMI: Ubuntu Server 24.04 LTS (HVM)

    • Instance type: t2.micro (Free Tier eligible)

    • Key pair: Create new prestashop-key.pem

    • Network settings:

      • Security group name: prestashop-app-sg

      • Inbound rules:

        • SSH (port 22) from 0.0.0.0/0

        • HTTP (port 80) from 0.0.0.0/0

  1. Click Launch instance

Step 2: Launch Database Server

  1. Launch another instance:

    • Name: prestashop-db-server

    • AMI: Ubuntu Server 24.04 LTS

    • Instance type: t2.micro

    • Key pair: Use existing prestashop-key.pem

    • Network settings:

      • Security group name: prestashop-db-sg

      • Inbound rules:

        • SSH (port 22) from EC2 Instance Connect range 18.206.107.24/29

        • MySQL (port 3306) from app server private IP 172.31.1.53/32

  1. Click Launch instance

Step 3: Verify Both Instances

From EC2 Dashboard, confirm:

  • Both instances show "Running"

  • Status checks: 2/2 passed

  • Note the IP addresses:

    • App server public IP: 100.55.84.213

    • App server private IP: 172.31.1.53

    • DB server private IP: 172.31.1.228

Phase 2: Configure Database Server

Step 1: Connect to Database Server

  1. In EC2 Console, select prestashop-db-server

  2. Click ConnectEC2 Instance ConnectConnect

Step 2: Install MySQL

# Update packages
sudo apt update
sudo apt upgrade -y

# Install MySQL server
sudo apt install mysql-server -y

# Check MySQL status
sudo systemctl status mysql

Step 3: Secure MySQL Installation

sudo mysql_secure_installation

Answer prompts:

  • Validate password component: Y

  • Password policy: 1 (MEDIUM)

  • Set root password: Choose strong password

  • Remove anonymous users: Y

  • Disallow root login remotely: Y

  • Remove test database: Y

  • Reload privilege tables: Y

Step 4: Create Database and User

# Log into MySQL
sudo mysql

# Create database
CREATE DATABASE prestashop;

# Create user (allow from any host)
CREATE USER 'prestashop_user'@'%' IDENTIFIED BY 'YourStrongPassword123!';

# Grant privileges
GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop_user'@'%';

# Also grant for app server's hostname
CREATE USER IF NOT EXISTS 'prestashop_user'@'ip-172-31-1-53.ec2.internal' IDENTIFIED BY 'YourStrongPassword123!';
GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop_user'@'ip-172-31-1-53.ec2.internal';

# Also grant for app server's private IP
CREATE USER IF NOT EXISTS 'prestashop_user'@'172.31.1.53' IDENTIFIED BY 'YourStrongPassword123!';
GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop_user'@'172.31.1.53';

# Apply changes
FLUSH PRIVILEGES;

# Verify
SHOW DATABASES;
SELECT User, Host FROM mysql.user WHERE User='prestashop_user';

# Exit MySQL
EXIT;

Step 5: Configure MySQL for Remote Access

# Edit MySQL config
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Find and change:

bind-address = 127.0.0.1

to

bind-address = 0.0.0.0

Save and exit (Ctrl+O, Enter, Ctrl+X)

Step 6: Restart MySQL

sudo systemctl restart mysql

# Verify MySQL is listening on all interfaces
sudo ss -tlnp | grep 3306
# Should show: 0.0.0.0:3306

Phase 3: Configure Application Server

Step 1: Connect to App Server

  1. In EC2 Console, select prestashop-app-server

  2. Click ConnectEC2 Instance ConnectConnect

Step 2: Install LAMP Stack

# Update packages
sudo apt update
sudo apt upgrade -y

# Install Apache
sudo apt install apache2 -y

# Install PHP and extensions
sudo apt install php libapache2-mod-php php-mysql php-xml php-curl php-mbstring php-zip php-gd php-intl php-cli php-soap unzip -y

# Enable Apache rewrite module
sudo a2enmod rewrite
sudo systemctl restart apache2

# Install MySQL client for testing
sudo apt install mysql-client -y

# Verify Apache is running
sudo systemctl status apache2

Step 3: Test Database Connection

# Test connection to database server
mysql -h 172.31.1.228 -u prestashop_user -p
# Enter password: YourStrongPassword123!
# If successful, type: EXIT;

Step 4: Download and Extract PrestaShop

# Navigate to web root
cd /var/www/html

# Remove default Apache page
sudo rm index.html

# Download PrestaShop
sudo wget https://github.com/PrestaShop/PrestaShop/releases/download/8.1.2/prestashop_8.1.2.zip

# Extract downloaded file
sudo unzip prestashop_8.1.2.zip

# Extract main PrestaShop archive (type 'A' when prompted to replace all)
sudo unzip prestashop.zip

# Clean up zip files
sudo rm prestashop.zip prestashop_8.1.2.zip

# Set correct permissions
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Phase 4: Complete PrestaShop Installation via Web Browser

Step 1: Access the Installer

Open browser and navigate to: http://100.55.84.213

Step 2: Follow Installation Wizard

Screen 1: Choose Language

  • Select English (English)

  • Click Next

Screen 2: License Agreements

  • Check agreement box

  • Click Next

Screen 3: System Compatibility

  • Verify all checks are green

  • Click Next

Screen 4: Store Information

  • Store name: My PrestaShop Store (or your choice)

  • Main activity: Select from dropdown

  • Country: Select your country

  • First name: Your first name

  • Last name: Your last name

  • Email address: your-email@example.com

  • Password: Create admin password

  • Click Next

Screen 5: Content of Your Store

  • Check both boxes for sample data

  • Click Next

Screen 6: Database Configuration

Enter these values:

Database server address: 172.31.1.228
Database name: prestashop
Database login: prestashop_user
Database password: YourStrongPassword123!
Tables prefix: ps_

Click "Test your database connection now!"

  • Verify: "Database is connected" message appears

  • Click Next

Screen 7: Store Installation

  • Wait for installation to complete (2-3 minutes)

  • Do not close browser

Step 3: Installation Complete

Success screen shows:

  • Email: Your admin email

  • Password: Your admin password

  • Buttons for Back Office (admin) and Front Office (store)

Step 4: Security Cleanup

Important: Delete the install folder

# On app server terminal
sudo rm -rf /var/www/html/install

Phase 5: Verification

Test Front Office

  1. Click "Discover your store" or navigate to http://100.55.84.213

  2. Verify store homepage loads correctly


Key Configuration Summary

Component Configuration
App Server Public IP 100.55.84.213
App Server Private IP 172.31.1.53
DB Server Private IP 172.31.1.228
Database Name prestashop
Database User prestashop_user
Database Password YourStrongPassword123!
Admin Email gbayiadewaku@gmail.com

Project Successfully Completed!

In this project, I successfully deployed a fully functional PrestaShop e-commerce platform on Amazon Web Services (AWS) Free Tier, with a clear separation between the application and database servers as required.

Key Achievements:

  1. Infrastructure Setup

    • Launched two EC2 instances (application server and database server) using Ubuntu 24.04 LTS

    • Configured security groups to allow appropriate traffic (HTTP, SSH, MySQL)

    • Established secure communication between servers using private IPs

  2. Database Configuration

    • Installed and secured MySQL on the dedicated database server

    • Created prestashop database and prestashop_user with proper permissions

    • Configured MySQL to accept remote connections from the application server

    • Successfully tested database connectivity

  3. Application Deployment

    • Installed LAMP stack (Apache, PHP, extensions) on the application server

    • Downloaded and extracted PrestaShop 8.1.2

    • Set proper file permissions for web server access

  4. Final Installation

    • Completed PrestaShop web installer with database connection

    • Created admin account for store management

    • Secured the installation by removing the install folder

    • Verified both front office and back office functionality