Installing a Magento 2 shop via CLI
You install Magento via the command line (CLI). Up to Magento version 2.3.6, you had two options for setting up the software: Either via a web setup wizard, or via CLI. Since version 2.3.7, you can only use the command line to install, configure or upgrade the shop system.
One advantage: You can run the setup several times in succession. This allows you to correct previous errors or make new settings, such as changing the database server.
Preparing the installation
Before you install the shop system, you should take a few precautions. Above all, this includes checking the system requirements.

Check system requirements
Check your system in advance to ensure that your server fulfils the necessary requirements.
Magento 2 system requirements
- You need a powerful server with reliable hosting to ensure flawless performance. We recommend a dedicated server or a virtual private server (VPS).
- The complex software requires a mature operating system, preferably a Linux operating system, especially CentOS, Ubuntu or Debian.
- PHP 8.1.x is required for the shop system. As of Magento version 2.4.6, PHP 8.2.x is supported - we recommend that you update the PHP version regularly and install security and function updates.
- You need a MySQL database. Versions 8.0, 5.7 or MariaDB 10.4 and higher are supported.
- Storage space for all your data and media files: The exact requirements depend on the size of your e-commerce website - a minimum of 10 GigaBytes (GB) is usually recommended.
- A minimum of 2 GB RAM is required. Experience has shown that 8 GB RAM is required for smooth operation. We recommend that you use at least 12 GB of RAM. This allows more data to be cached in the RAM - for example from Varnish, Redis and Elasticsearch/OpenSearch.
- You can run the software on various web servers such as Apache or Nginx. Apache version 2.4 or higher is recommended.
- Magento requires additional software such as Composer, GIT and Elasticsearch/OpenSearch.
More detailed information on the system requirements from version 2.4: Manufacturer requirements

Install Composer
To simplify the process, we use Composer (Download). This makes it easier for you to install the software properly. For example, the application helps you to check the system requirements or determine whether there are version conflicts between your applications.

Creating a database
Create a database and a database user on your server. Attention! Assign a unique user name and a secure password. Also make sure that you enter the data correctly.

Generate an authentication key
To access the Magento Open Source metapackage via Composer, you need an authentication key.
TIP: You can use the command bin/magento list to list all available installation and configuration commands in the command line.
Magento installation in 5 steps
Once you have made the above preparations, you can start installing the shop system.

Step 1: Log in to the application server
Log in to the application server via SSH. Make sure that the user you are logging in with has the necessary write authorisation for the installation directory. Depending on which user owns the file system, you can use the following commands to switch to the user or execute commands on behalf of the user.
Switch to the file system owner:
su <file system owner> -s /bin/bash -c <command>
Execute command as file system owner:
sudo -u <file system owner> <command>

Step 2: Retrieve metapackage
The Magento metapackage is retrieved into the base directory of the web server or into a directory that you have configured as the host base directory. To do this, change to the corresponding directory.
cd <Magento Root Directory>/
The directory must be empty so that Composer can create a new Magento project. If there are files or folders in the Magento root directory, you should delete them. Make sure that you do not delete any files that you still need elsewhere.
Now create a new Composer project in the Magento root directory.
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name>
When prompted, enter the previously created authentication key. Note: You can usually find your public and private key in your Marketplace account.

Step 3: Grant write access
Make sure that the web server has write access to the Magento root directory. This is necessary so that Magento can write the required configuration files during the installation.
For the Apache web server, you can use the following commands:
cd <Magento Root Directory>/
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data . # Ubuntu
chmod u+x bin/magento
TIP: Install Magento locally
If you are setting up an e-commerce shop for the first time, we recommend that you first install the software locally on your system and familiarise yourself with it. To call up the page, enter localhost/directoryname in the address bar of your browser. You can simply follow all further steps as described.

Step 4: Installing Magento
To finally install Magento, use the CLI. You can pass various instructions to the installation command. You can display a complete list directly in the CLI or view it on this page: Installing via the command line.
In this example, we assume that the db-host is on the same computer (localhost) and the db-name, db-user and db-password are all ‘magento’. <domain> must be replaced according to the domain used. The admin user data can also be customised:
bin/magento setup:install \
--base-url=https://<Domain>/ \
--base-url-secure=https://<Domain>/ \
--use-secure=1 \
--use-secure-admin=1 \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=de_DE \
--currency=EUR \
--timezone=Europe/Berlin \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=es-host.example.com \
--elasticsearch-port=9200 \
--elasticsearch-index-prefix=magento2 \
--elasticsearch-timeout=15
Further information will be displayed after installation. Make a note of this. For example, the admin URL is automatically generated during this installation command - it is required for the subsequent login to the backend.
TIP: Help for CLI commands
This gives you help for a specific command:
bin/magento help <command>
This can look like this, for example:
bin/magento help setup:install

Step 5: Check installation
After installation, call up the URL of the shop in the browser. Use the value entered under ‘--base-url-secure’ during installation. A Magento shop should now be displayed.
To log in to the backend, use the URL generated during installation and the admin data provided. Alternatively, you can display the admin URL with this command:
bin/magento info:adminuri
After successful installation: Configure your web shop

You can now start setting up the system. Customisations to the shop are no problem. These include
- Creating categories, attributes and products
- Set up shipping methods and payment methods
- Entering content for e.g. terms and conditions and legal notice
You will find further options for setting up your shop in the manufacturer's configuration manual.
Magento installation - with or without a service provider?
If your company has in-depth development knowledge, you can install Magento 2 yourself. If you would like support with the installation of your shop application or need advice on preparing all the system requirements, atlantis dx will be happy to help. As a certified Magento agency and experienced e-commerce service provider, we will actively support your digital projects.
FAQ on the installation of Magento
Check the system requirements in advance. To install the Magento software, use the CLI (Command Line Interface). The Composer will help you to set up the software properly.
In the current version, Magento is installed via Composer. You do not need a separate software download for this.
You can easily install Magento locally. This allows you to familiarise yourself with the shop system.