PrestaShop Installation

How Can We Help?

PrestaShop Installation

You are here:
< Back to the Wiki

Are you dreaming of your own web shop? Do you want to try PrestaShop and start your new shopping imperium? This article will explain how to install PrestaShop.

Prerequisites

According to the System requirements for PrestaShop 8 (devdocs.prestashop-project.org), PrestaShop requires the following resources quite minimal resources, therefore we gave it the following:

  • 2 CPUs
  • 1GB of Memory
  • 8GB of Storage

For future notice, the PrestaShop changelog can be found at github.com.

To validate the requirements have a look at the validation chapter down below.

Installation

MariaDB

PrestaShop requires a database to save its data. To install MariaDB run apt-get install mariadb-server. After the installation is finished secure the database by running mysql_secure_installation. This will prompt the following questions:

  • Enter current password for root: Fill in your root password
  • Switch to unix_socket authentication: Press n since we already have a root user
  • Change root password: Press Y and fill in a new password or your root password
  • Remove anonymous users: Press Y since we will add specific users later
  • Disallow root login remotely: Press Y since logging in locally is more secure
  • Remove test database and access to it: Press Y since we will add a specific database later
  • Reload privilege tables now: Press Y to update the database
Securing MariaDB database

Now open a connection to the database using mysql -u root -p and enter the following:

CREATE DATABASE prestashop_db;
CREATE USER 'prestashop_user'@'localhost' identified by '****';
GRANT ALL PRIVILEGES ON prestashop_db.* TO 'prestashop_user'@'localhost';
FLUSH PRIVILEGES;
QUIT;

This will set up a database with a user which will be used later for PrestaShop. Make sure to modify the variables to your needs, and write the details down for the next steps.
Alternatively, you can add the above-mentioned SQL statements to a file and let the database apply it using the following command:

cat ~/prestashop-database.sql | mysql --defaults-extra-file=/etc/mysql/debian.cnf

Apache

To be able to visit the PrestaShop website, you need a web server. We will use Apache, to install it and run apt-get install apache2.

PrestaShop requires the rewrite and the headers module, to enable them run a2enmod __MODULE__ and restart Apache using systemctl restart apache2.

PHP

PrestaShop requires PHP to run, below is a table showing the recommended PHP (8.2) packages for PrestaShop.

NamePackageImportanceMotivation
CURLphp8.2-curlRequiredUsed to download remote resources like modules and localization packages
DOMEnabled by defaultRequiredNeeded to parse XML documents
FileinfoEnabled by defaultRequiredUsed to find out the file type of uploaded files
GDphp8.2-gdRequiredUsed to create thumbnails for the images that you upload
IconvEnabled by defaultRequiredUsed to convert character sets
Intlphp8.2-intlRequiredUsed to display localized data
JSONEnabled by defaultRequiredUsed to manage JSON format
Mbstringphp8.2-mbstringRequiredTo perform string operations everywhere
OpenSSLopensslRequiredUsed to improve security
MySQLphp8.2-mysqlRequiredUsed to connect to MySQL databases
SimpleXMLphp8.2-xmlRequiredUsed to manage XML files
Zipphp8.2-zipRequiredUsed to expand compressed files
BCMathphp8.2-bcmathOptional
ImageMagickphp8.2-imagickOptional
Memcachedphp8.2-memcachedOptional
Recommended PHP packages for PrestaShop from devdocs.prestashop-project.org

To install the packages select your preferred packages and run apt-get install <packages separated by spaces>.

To verify which PHP modules are enabled use php -v. If there are modules that are not enabled yet, you can run phpenmod __MODULE__.

Restart the webserver to make sure that it uses the newly enabled modules: systemctl restart apache2.

Since we have installed an Apache web server we also require a PHP package to communicate with Apache, install it using apt-get install libapache2-mod-php8.2. To validate if PHP works, create a file named /var/www/html/php_info.php and add the following:

<?php
phpinfo();
?>

If you navigate to __YOUR_URL__/php_info.php you should see an information page about the PHP installation.

PHP info

Additionally, PrestaShop requires some PHP settings, therefore, open /etc/php/8.2/apache2/conf.d/prestashop.ini and add the following:

extension = php_mysql.dll
extension = php_gd2.dll
allow_url_fopen = On
allow_url_include = Off

max_input_vars = 1024
memory_limit = 256M
post_max_size = 16M
upload_max_filesize = 4M

Now restart Apache using systemctl restart apache2 to enable the changes.

PrestaShop

Download the latest version from prestashop.com using wget.

To install PrestaShop from the source, use the following commands:

# Navigate to the Apache web server file location
cd /var/www/html
# Download PrestaShop
wget https://download.prestashop.com/download/releases/prestashop_8.1.1.zip
# Extract the files
unzip prestashop_8.1.1.zip
# Set the correct ownership for the web server
chown -R www-data:www-data /var/www/html
# Optional: Cleanup
rm -rf index.html php_info.php prestashop_8.1.1.zip

Optionally, if you want to install a custom PrestaShop version go to the version page (prestashop.com), copy the link of your preferred version and download and extract it on your server.

Navigate to __PRESTASHOP_URL__. Choose your preferred language and click Next.

Choose your language

Accept the License Agreements and click Next.

License agreements

Validate the System compatibility and click Next.

System compatibility

Fill out the shop details and add account details. Once satisfied click Next.

Store information

Select whether or not you want demo data and select the installation modules. Click Next when satisfied.

Content of your store

Fill in your database configuration, test it, and once it works click Next.

System configuration

PrestaShop will no install your webshop, and will show you once its finished. It will have a link to two URLs, the first one is the frontend, which represents your store, and the second one is the backend to manage the store. The backend becomes available once you delete the install folder from your webserver.

Store installation

Validation

To validate if the server meets the requirements of PrestaShop, download the phppsinfo.php from this GitHub repository (github.com) and place it in your PrestaShop installation folder.

Now navigate to __PRESTASHOP_URL__/phppsinfo.php and login with prestashop as username and password. Here you will be presented with an overview of the server requirements and whether your server is up to specification.

Sources

2 Responses

  1. Lorie says:

    Your platform holds my attention from beginning to end. I find myself engrossed into every word you write.

  2. Alline says:

    This is an invaluable resource for anyone interested in this topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents