Installing Magento with SSH console

Starting from Magento version 2.3.7, installation is available only through the SSH console.

Get Magento code from Git

Get code from Github Magento repository

git clone https://github.com/magento/magento2.git .

After code is loaded can select Magento version for install.
For example – install/ switch to version Magento 2.4.6-p4.

Magento github tags

CLI command

git checkout tags/2.4.6-p4

Install libs with Composer

cd /var/www/html

Go to the site root.

Run CLI command for Composer install – will be downloaded libs from external repositories. In some cases need also provide access to external repositories of code.

composer install

So ready.

Add additional lib for Elasticsearch

composer require elasticsearch/elasticsearch:7.17.2 --with-all-dependencies

Change version of Elasticsearch that will be used for an Magento app.

CLI command for install Magento


Run the SSH command to install Magento

php -d memory_limit=-1 bin/magento setup:install --cleanup-database --base-url=https://new.magento.com/ --db-host=db --db-name=magento --db-user=magento --db-password=magento --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com --admin-user=admin --admin-password=Magento2023 --session-save=files --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=elasticsearch --elasticsearch-port=9200 --elasticsearch-timeout=15 --elasticsearch-index-prefix=magento --elasticsearch-enable-auth=false --elasticsearch-username='' --elasticsearch-password=''

Set the following options/parameters

  • –cleanup-database
  • –base-url – Site URL
  • –db-host – database server
  • –db-name – database name
  • –db-user – database user (login)
  • –db-password – database user password
  • –admin-firstname , –admin-lastname – admin’s first and last name
  • –admin-email – email admin
  • –admin-user – admin login
  • –admin-password – admin password
  • –session-save – session storage type
  • –use-rewrites – use URL rewrite
  • –search-engine
  • –elasticsearch-host
  • –elasticsearch-port
  • –elasticsearch-timeout
  • –elasticsearch-index-prefix
  • –elasticsearch-enable-auth
  • –elasticsearch-password

These are the basic options for Magento installation.
A more detailed description of all the available options when installing Magento can be obtained by running the following cli command.

Run the SSH command

php bin/magento setup:install -h

If Magento is installed successfully, the following will be displayed in the console:

[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin_XXXXX