How to Install Magento 2.4.4 on Debian 11?

How to Install Magento 2.4.4 on Debian 11?

Magento is a popular ecommerce platform written in PHP and uses the Zend framework.

The platform offers a range of native features to run an online store.

We cover the steps to install the open-source Magento 2.4.4 on Debian 11.

Pre-requisites to Install Magento on Debian 11

You can check the system requirements for installing Magento 2.

Pre-requisites to Install Magento on Debian

Ensure that you have the following prerequisites-

  • Apache Web server
  • MySQL 8.0
  • PHP 8.1
  • Composer – an application-level package manager for the PHP

Steps to Install Magento 2.4.4 on Debian 11

1. Update Operating System

Update the Debian 11 operating system to ensure all existing packages are up to dat. Use the command line to add the following -

$ sudo apt update && sudo apt upgrade -y 

2. Install Apache web server

To install the Apache web server, run the following command:

$ sudo apt install apache2

Once installed, Apache should be running. If it’s not, you can start it using this -

$ sudo systemctl start apache2

You can now enable it to start on boot time.

$ sudo systemctl enable apache2

3. Install PHP and PHP extensions for Magento 2.4.4

By default, PHP 8.1 is not included in the Debian 11 default repository.

You have to add the DEB.SURY.ORG repository to APT.

You the following command to install the required packages.

$ sudo apt-get install ca-certificates apt-transport-https software-properties-common -y

Once all the packages are installed, add a Sury repository to APT using the following command:

$ sudo echo "deb $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list

Download and add the GPG key with the following command:

$ sudo wget -qO - | apt-key add -

After it is done, update the repository.

$ sudo apt-get update -y

You can now install the PHP 8.1 with the following command:

$ sudo apt-get install php8.1 libapache2-mod-php php8.1-dev php8.1-bcmath php8.1-intl php8.1-soap php8.1-zip php8.1-curl php8.1-mbstring php8.1-mysql php8.1-gd php8.1-xml

Verify if PHP is installed.

php -v
PHP 8.1.4 (cli) (built: Mar 20 2022 16:52:39) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies
with Zend OPcache v8.1.4, Copyright (c), by Zend Technologies

4. Update php.ini file

You can now increase values in the php.ini file. First, open the php.ini file.

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

Change the following data:

file_uploads = On
allow_url_fopen = On
short_open_tag = On
memory_limit = 512M
upload_max_filesize = 128M
max_execution_time = 3600

After this, save this php.ini file.

Restart apache2 for the configuration to work.

sudo systemctl restart apache2.service

5. Install MySQL 8 and Create a mySQL Database

To add the MySQL APT repository to your system run the command below -

$ sudo wget

Install the release package.

$ sudo apt install ./mysql-apt-config_0.8.22-1_all.deb

Now, install MySQL with the following command -

$ sudo apt install mysql-server

Start the database server daemon. Enable it to start automatically at the next boot with these commands -

$ systemctl start mysql
$ systemctl enable mysql

Once the database server is installed, log into the MySQL prompt -

$ sudo  mysql -u root -p

Run the next commands to create a database, database username and password, and grant all privileges to the database user.

mysql> CREATE DATABASE magento_db;
mysql> CREATE USER 'magento_user'@'localhost' IDENTIFIED BY 'Password';
mysql> GRANT ALL ON magento_db.* TO 'magento_user'@'localhost';
mysql> EXIT

6. Installing Elastic Search

For Magento 2.4, all installations should be configured to use Elasticsearch. It is used as the catalog search engine.

Elasticserach uses a secure HTTPS transaction for the repositories.

Before installing the search engine, we have to install the required dependencies. Use the following command -

$ sudo apt install apt-transport-https ca-certificates gnupg2

Import the Elasticsearch GPG key.

$ sudo wget -qO - | sudo apt-key add -

Add the Elasticsearch repository.

$ sudo sh -c 'echo "deb stable main" > /etc/apt/sources.list.d/elastic-7.x.list'

Update the apt package manager and install Elasticsearch with the next command-

$ sudo apt update && apt install elasticsearch

After this, you can start and enable the service.

$ sudo systemctl start elasticsearch.service
$ sudo systemctl enable elasticsearch.service

Use the command below to verify that Elasticsearch is running properly.

curl -X GET "localhost:9200/"

If Elasticsearch is working properly, the result will look like the following -

"name" : "debian",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "_95g0f6tQpOQZMR7ySyQQw",
"version" : {
"number" : "7.17.2",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "de7261de50d90919ae53b0eff9413fd7e5307301",
"build_date" : "2022-03-28T15:12:21.446567561Z",
"build_snapshot" : false,
"lucene_version" : "8.11.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
"tagline" : "You Know, for Search"

7. Install Composer

To download Composer, run the following command -

$ sudo curl -sS | php

Next, move the composer file to the /usr/local/bin path.

$ sudo mv composer.phar  /usr/local/bin/composer

Assign the execute file permission -

$ sudo chmod +x   /usr/local/bin/composer

Verify the Composer version installed with the following command -

$ sudo composer --version

Composer version 2.2.6 2022-02-04 17:00:38

8. Install Magento 2.4.4

It is recommended to install Magento using the Marketplace and by creating an access key.

For generating Access keys go to:

My profile > Marketplace > My products > Access Keys

Run the following command to download Magento 2.4.4

composer create-project --repository-url= magento/project-community-edition=2.4.4 /var/www/magento2
  • Username : Your Public Key
  • Password : Your Private Key

Go to the Magento directory-

$ cd /var/www/magento2

Chmod cache and static content folder -

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +

Change the ownership of the Magento directory to the webserver user. Also change the permissions -

sudo chown -R www-data:www-data /var/www/magento2
sudo chmod -R 755 /var/www/magento2

Install Magento using the composer command, type:

$ sudo bin/magento setup:install \
--base-url= \
--db-host=localhost \
--db-name=magento_db \
--db-user=magento_user \
--db-password=Password \
--admin-firstname=Admin \
--admin-lastname=User \ \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \

After the installation you can see the admin link for your Magento site.

[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin_1od1xl
Nothing to import.

9. Configure Apache Web Server for Magento 2.4.4

Navigate to /etc/apache2/sites-available directory.

Run the following command to create a configuration file for the Magento installation -

$ sudo nano /etc/apache2/sites-available/magento.conf

Add the content shown below-

<VirtualHost *:80>


DocumentRoot /var/www/magento2/pub

<Directory /var/www/magento2/>
        AllowOverride All

ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined


Save the file and Exit.

Enable the Magento virtual host. Ensure that you enable rewrite mod to use site friendly URLs:

$ sudo a2ensite magento.conf
$ sudo a2enmod rewrite

Restart the Apache web server.

$ sudo systemctl restart apache2

10. Access Magento 2.4.4 Application

Open your browser and enter your domain name. For example

You can see the following result -

Access Magento 2.4.4 Application


Magento recommends using Linux-based systems to get the full compatibility of the platform.

Debian 11 Bullseye is the latest Linux distro and is open source, affordable and offers high security.

We have covered the steps to install Magento 2.4.4 on Debian 11.

To get more updates on Magento platform, check out MGT Commerce tutorials.

Nikita S.
Nikita S.
Lead Technical Writer

As a lead technical writer, Nikita S. is experienced in crafting well-researched articles that simplify complex information and promote technical communication. She has expertise in cloud computing and holds a specialization in SEO and digital marketing.

Get the fastest Magento Hosting! Get Started