Skip to main content

How to Install PrestaShop on Ubuntu 24.04 LTS

In this detailed step-by-step guide, we will show you how to install PrestaShop on Ubuntu 24.04 LTS "Noble Numbat". PrestaShop is a widely used open-source e-commerce platform, which allows you to create and manage an online store easily and intuitively.

We will follow all the necessary steps to configure the system and start our online store.

System Requirements

Before we start, let's make sure that our server meets the minimum requirements for installing PrestaShop:

  • Operating System: Ubuntu 24.04 with SSH access
  • RAM:At least 2GB of memory to be allocated for PHP scripts

How to Install PrestaShop on Ubuntu 24.04 LTS

In the next steps we will see how to install PrestaShop on Ubuntu 24.04 LTS "Noble Numbat". We will see how to install:

  1. The Apache2
  2. The PHP
  3. Database MySQL or MariaDB
  4. Create PrestaShop DB
  5. The download and configuration of PrestaShop

Installation of Apache2

Apache2 is the web server that will handle requests for your PrestaShop store. To install it, run the following commands:

sudo apt update && sudo apt install apache2

PrestaShop also requires the use of apache's rewrite module, let's activate it:

sudo a2enmod rewrite

Installing PHP 8.1

PrestaShop recommends using PHP 8.1. To install PHP 8.1 in Ubuntu 24.04, which is not present by default (version 8.3 is distributed), we add the ppa:ondrej/php repository.

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Update the list of packages

sudo apt update

Install PHP 8.1 and the required extensions:

sudo apt install php-pear php-json libapache2-mod-php8.1 php8.1-{curl,xml,common,gd,intl,mbstring,mysql,zip}

We edit the php.ini file to configure PHP:

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

Add or edit lines as follows:

allow_url_fopen = On
allow_url_include = Off

Linux server management for PrestaShop

With our Linux support and consulting Free 30m Analysis to Optimize Your E-commerce, Contact Us Now!

Installing MySQL or MariaDB

PrestaShop requires a database to run. You can choose to install MySQL or MariaDB.

a. Install MySQL

To install MySQL, run the following command:

sudo apt install mysql-server

After the installation is complete, verify that the MySQL server is up:

sudo service mysql status
 * MySQL is stopped.

If MySQL is not active restart it

sudo service mysql restart

b. Install MariaDB

If you prefer to use MariaDB, run the following command:

sudo apt install mariadb-server

Check that the MariaDB server is active:

sudo service mariadb status
 * MariaDB is stopped.

If MariaDB is not active restart it

sudo service mariadb restart

For more information on how to install MySQL or MariaDB, consult our comprehensive guide to installing MySQL.

Create PrestaShop Database

Let's create a new database, user and password for accessing the PrestaShop database. Replace password with a secure password and change the username and database name if necessary:

sudo mysql -e "CREATE DATABASE prestashop;"
sudo mysql -e "GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop'@'%' IDENTIFIED BY 'password';"

To list the available databases, run:

sudo mysql -e "SHOW DATABASES;"

You should see a list that includes the database created, for us prestashop.

+---------------------+
| Database |
+---------------------+
| information_schema |
| mysql |
| performance_schema |
| prestashop |
| sys |
+---------------------+
5 rows in set (0.00 sec)

Downloading and Configuring PrestaShop

You can download the latest version of PrestaShop from the official GitHub repository: https://github.com/PrestaShop/PrestaShop

Download the ZIP file of the latest stable version to a temporary directory. For example, if you are downloading version 8.1.7, you can use the following command:

cd /var/www/html
sudo apt install -y wget unzip
wget https://github.com/PrestaShop/PrestaShop/releases/download/8.1.7/prestashop_8.1.7.zip

Extract the ZIP file containing the installation:

unzip prestashop_8.1.7.zip

Remove the installation file:

rm /var/www/html/Install_PrestaShop.html

Change the ownership of the PrestaShop directory and its contents to the user and group ww-data, default to web server:

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

Remove the installation directory:

sudo rm -fr /var/ww/html/install/

Now, you can access the PrestaShop installation interface by opening a Web browser and going to http://IP-SERVER/. Replace IP-SERVER with your server's IP address.

Configuring PrestaShop

Now that we've managed to Install PrestaShop on Ubuntu 24.04, follow the instructions in the interface to complete the configuration of PrestaShop. You will need to provide information such as your store name, email address, and payment information.

Frequently Asked Questions (FAQs)

Can I use a different version of PHP?

PrestaShop recommends PHP 8.1 to ensure compatibility and best performance. Using other versions may cause problems.

Should I use Apache or can I use another web server?

This guide covers installation with Apache. However, PrestaShop is also compatible with Nginx and other web servers.

How can I ensure the security of my server?

Be sure to regularly update your system and packages, use firewalls and other security measures to protect your server.

Add new comment

Comment

  • Allowed HTML tags: <br> <p> <code class="language-*"> <pre>
  • Lines and paragraphs break automatically.
  • Only images hosted on this site may be used in <img> tags.