Install PrestaShop on Ubuntu 24.04 for Entry-Level E-commerce
Introduction
This beginner-friendly guide shows you how to deploy PrestaShop on Ubuntu 24.04 using a ServerStadium dedicated server (or ServerStadium VM). You’ll install the LAMP stack, configure PHP for PrestaShop 9, secure your site with free SSL from Let’s Encrypt, and set up basic email and payment modules—everything you need to start selling quickly.
Prerequisites
- A ServerStadium dedicated server or VM running Ubuntu 24.04, with a domain pointing to your server’s public IP.
- SSH access with a sudo-capable user.
- An email address for Let’s Encrypt notices and SMTP credentials (for order emails).
Step 1 — Update and Install LAMP + PHP Extensions
Install Apache, MySQL, PHP 8.3 (default on Ubuntu 24.04), and the PHP extensions PrestaShop needs.
sudo apt update && sudo apt -y upgrade
sudo apt -y install apache2 mysql-server \
php php-fpm php-mysql php-curl php-xml php-gd php-zip php-mbstring php-intl php-json \
unzip curl composer
sudo a2enmod rewrite
sudo systemctl enable --now apache2 mysql
Step 2 — Create the PrestaShop Database
sudo mysql_secure_installation
sudo mysql -e "CREATE DATABASE psdb DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;"
sudo mysql -e "CREATE USER 'psuser'@'localhost' IDENTIFIED BY 'ChangeThisStrongPassword!';"
sudo mysql -e "GRANT ALL PRIVILEGES ON psdb.* TO 'psuser'@'localhost'; FLUSH PRIVILEGES;"
Step 3 — Tune PHP for PrestaShop
PrestaShop 9 runs best with generous PHP limits (e.g., 512M memory per script). Create a small override file so updates won’t overwrite your settings.
echo "memory_limit = 512M
max_execution_time = 180
post_max_size = 128M
upload_max_filesize = 128M
max_input_vars = 5000
allow_url_fopen = On" | sudo tee /etc/php/8.3/apache2/conf.d/99-prestashop.ini >/dev/null
sudo systemctl reload apache2
Step 4 — Get PrestaShop 9 (Composer Install)
Using Composer keeps the install clean and compatible with PHP 8.3 on Ubuntu 24.04.
sudo mkdir -p /var/www/prestashop
sudo chown -R $USER:$USER /var/www/prestashop
composer create-project prestashop/prestashop:^9 /var/www/prestashop
sudo chown -R www-data:www-data /var/www/prestashop
Step 5 — Configure Apache Virtual Host
Replace example.com
with your domain. This vHost serves PrestaShop from /var/www/prestashop
and allows .htaccess rewrites.
sudo tee /etc/apache2/sites-available/prestashop.conf >/dev/null <<'EOF'
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/prestashop
<Directory /var/www/prestashop>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/prestashop_error.log
CustomLog ${APACHE_LOG_DIR}/prestashop_access.log combined
</VirtualHost>
EOF
sudo a2ensite prestashop.conf
sudo systemctl reload apache2
Step 6 — Enable HTTPS with Let’s Encrypt
sudo apt -y install certbot python3-certbot-apache
sudo certbot --apache -d example.com -d www.example.com --redirect -m you@example.com --agree-tos -n
Step 7 — Run the PrestaShop Installer
- Visit
https://example.com
to launch the installer. - When prompted for database details, use:
Database=psdb
,User=psuser
,Password=ChangeThisStrongPassword!
,Server=localhost
. - Finish the wizard, then remove the installer directory:
sudo rm -rf /var/www/prestashop/install
- For security, PrestaShop may ask you to rename the admin folder. Keep the name safe and private.
Email & Payments (Basics)
- Order emails: In Back Office, open Advanced Parameters → E-mail. Choose SMTP, enter your provider’s host, port, encryption (TLS/SSL), username, and password. Send a test email.
- Payments: In Modules → Module Manager, search and install official gateways (e.g., Stripe, PayPal). Connect your merchant account and enable the payment methods you want to offer.
Performance & Security Tips
- Pretty URLs: In Shop Parameters → Traffic & SEO, enable “Friendly URL.”
- Caching: In Advanced Parameters → Performance, enable caching and Smarty template compilation optimizations.
- Firewall: Allow web/SSH traffic and enable UFW:
sudo ufw allow OpenSSH && sudo ufw allow 80 && sudo ufw allow 443 && sudo ufw enable
- Backups: Back up files and database before theme/module changes and weekly thereafter.
Quick Backup Script (Optional)
sudo mkdir -p /opt/ps-backups
sudo tee /opt/ps-backups/backup.sh >/dev/null <<'EOF'
#!/usr/bin/env bash
set -e
TS=$(date +%F-%H%M)
SITE_ROOT="/var/www/prestashop"
DB_NAME="psdb"
DB_USER="psuser"
DB_PASS="ChangeThisStrongPassword!"
mkdir -p /opt/ps-backups/${TS}
mysqldump -u ${DB_USER} -p${DB_PASS} ${DB_NAME} | gzip > /opt/ps-backups/${TS}/db.sql.gz
tar -czf /opt/ps-backups/${TS}/ps-files.tgz -C "${SITE_ROOT}" .
find /opt/ps-backups -maxdepth 1 -type d -mtime +14 -exec rm -rf {} \; 2>/dev/null || true
EOF
sudo chmod +x /opt/ps-backups/backup.sh
echo "15 2 * * * root /opt/ps-backups/backup.sh" | sudo tee /etc/cron.d/ps-backup >/dev/null
Troubleshooting
- Installer says requirements not met: Confirm all PHP extensions are installed, and that
memory_limit
is at least512M
. - HTTP 500 after enabling pretty URLs: Make sure
a2enmod rewrite
is enabled and your vHost usesAllowOverride All
; thensudo systemctl reload apache2
. - SSL certificate fails: Ensure DNS A/AAAA records point to your server before running Certbot; then re-run with
--apache
. - Back office email not sending: Verify SMTP settings in Advanced Parameters → E-mail, check provider ports/SSL, and test again.
Launch confidently on a low-cost, instant ServerStadium dedicated server—optimized for reliable, fast e-commerce hosting.
Conclusion
Your PrestaShop store is now live, secured with HTTPS, tuned for performance, and ready to accept payments. For more help or information about ServerStadium services, visit our knowledge base or the ServerStadium website.