PrestaShop

PrestaShop

PrestaShop is an open-source platform used to build online stores (e-commerce). Developed using the PHP programming language, PrestaShop offers flexibility and a variety of features to simplify the management of online stores, such as product management, orders, payments, and shipping. The platform supports multiple languages and currencies, making it suitable for international businesses. Additionally, PrestaShop has a module and theme ecosystem that can be customized to meet specific business needs.

1. System Requirements

System requirements for running PrestaShop 8:

  • Apache web server v2.4
  • PHP 8.1
  • MySQL 5.7+ or MariaDB 10.2+

Before starting the deployment, prepare the following:

  • A VPS or server with Ubuntu 24.04 LTS OS
  • SSH access to the server
  • A domain already pointed to the server

2. Server Preparation

Update the system

sudo apt update
sudo apt upgrade -y

Install Apache

sudo apt install apache2 -y

Install MariaDB

sudo apt install mariadb-server -y

Install the PPA ondrej/php repository.

sudo add-apt-repository ppa:ondrej/php -y
sudo apt upgrade -y

Install PHP 8.1 and the required extensions.

sudo apt install libapache2-mod-php8.1 php8.1 php8.1-common \
    php8.1-cli php8.1-gd php8.1-xml php8.1-mbstring \
    php8.1-mysql php8.1-curl php8.1-intl php8.1-zip -y

Open the php.ini configuration file.

sudo nano /etc/php/8.1/apache2/php.ini

Set the memory_limit.

memory_limit = 256M

Install Composer

sudo wget https://getcomposer.org/download/latest-stable/composer.phar -O /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

3. Create a Database

Log in to MariaDB.

sudo mysql

Create a database and user.

CREATE DATABASE prestashop COLLATE utf8mb4_general_ci;
CREATE USER 'prestashop'@'localhost' IDENTIFIED BY 'rahasia';
GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop'@'localhost';
FLUSH PRIVILEGES;
exit

4. Apache Configuration

Create a virtual host configuration for contoh.com.

sudo nano /etc/apache2/sites-available/contoh.com.conf	

Enter the configuration.

<VirtualHost *:80>
    ServerName www.contoh.com
    ServerAlias contoh.com
    DocumentRoot /var/www/contoh.com
    <Directory /var/www/contoh.com>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog /var/log/apache2/contoh.com_error.log
    CustomLog /var/log/apache2/contoh.com_access.log combined
</VirtualHost>

Enable the rewrite module, virtual host, and restart apache2.

sudo a2enmod rewrite
sudo a2ensite contoh.com
sudo systemctl restart apache2	

Install certbot

sudo apt install certbot python3-certbot-apache -y	

Request an SSL certificate.

sudo certbot --non-interactive \
    -m [email protected] \
    --agree-tos \
    --no-eff-email \
    --apache -d contoh.com -d www.contoh.com \
    --redirect	

5. Install PrestaShop

Download PrestaShop from GitHub.

wget https://github.com/PrestaShop/PrestaShop/releases/download/8.2.0/prestashop_8.2.0.zip

Extract prestashop_8.2.0.zip.

sudo apt install unzip -y
unzip prestashop_8.2.0.zip -d prestashop_8.2.0
sudo unzip prestashop_8.2.0/prestashop.zip -d /var/www/contoh.com

Change the user-group of the directory.

sudo chown -R www-data:www-data /var/www/contoh.com

Access https://www.contoh.com to install PrestaShop:

  1. Select the installation language, e.g., English (English), then click Next.
  2. License agreement: Check I agree to the above terms and conditions. under Licence Agreements, then click Next.
  3. System environment check: If all requirements are met, click Next.
  4. Enter store information and admin account details, then click Next.
  5. Choose options for install demo products and install all modules, then click Next.
  6. Database configuration: Enter the database name, username, and password, then click Next.
  7. Installation complete: Remove the install directory.
sudo rm -rf /var/www/contoh.com/install

The admin URL is randomly generated, for example, admin069dyauwgzwtzu1bc7d, which is the name of the admin directory located in /var/www/contoh.com.

ls -l /var/www/contoh.com