How to exploit all commands in Magento 2 CLI (Part 8)

In this Article we going to discuss about the Magento 2 Command line (CLI)

Part 8: Install Magento

Everyone knows Magento 2 has a powerful command-line interface tools (CLI). It permits you to complete task including installation, configuration, database backups, compiling LESS etc. Here I will show you how to install Magento using command-line in Magento 2. Before starting this guide please,refer our previous guidelines

Set up Magento using the following command:

php bin/magento setup:install –<option>=<value> … –<option>=<value>

The option and value are listed below:

-Admin- first nameMagento Admin User’s First NameYes
-Admin- last nameMagento Admin User’s Last NameYes
-Admin- EmailMagento Admin User’s EmailYes
-Admin- UserMagento Admin User’s UserYes
-AdminMagento Admin User’s Password


-passwordThe password should be at least 7 characters in length and should contain at least one alphabetic and at least one numeric character.Yes
-Base urlBase URL to exploit to access your Magento Admin and storefront. It should point to Magento install dir.

http[s]://<host or ip>/<your Magento install dir>/

Admin first nameMagento Admin first nameYes
–backend-frontnameUniform Resource Identifier (URI) to entrance the Magento Admin.

For example: admin, admin_123, admin_x67, etc.

–db-hostThe database server’s fully qualified host name or IP address.

The default value is localhost (

–db-nameThe name of database which is used to install Magento

Default value is magento2

–db-userUser name of database which is exploit to install Magento.

Default value is root

–db-passwordThe password of db-userno
–db-prefixThe prefix of tables in Magento dbno
–languageLanguage code to exploit in the Admin and storefront.

By applying command below to observe the list of language code:

php bin/magento info:language:list

–currencyDefault currency to employ in the storefront

The following  command below to observe the list of currency:

php bin/magento info:currency:list

–timezoneDefault time zone to exploit in the Admin and storefront.

The following command below to observe the list of timezone:

php bin/magento info:timezone:list

–use-rewrites1: it means you employ web server rewrites for making links in the storefront and Admin.

0: disables the employ of web server rewrites. This is the default.

–use-secure1: It allows the use of Secure Sockets Layer (SSL) in all storefront URLs.Clear in your mind your web server carries SSL before you choose this option.

0: disables the exploit of SSL with Magento. In this case, all other secure URL options are assumed to also be 0. This is the default.

–base-url-secureSecure base URL to use to access your Magento Admin and storefrontno
–use-secure-admin1: means you use SSL to access the Magento Admin. Clear in your mind your web server supports SSL before you select this option.

0: means you do not exploit SSL with the Admin. This is the default.

–admin-use-security-key1: causes the Magento software to use a randomly generated key value to access pages in the Magento Admin and in forms. The following key values assist prevent cross-site script fake attacks. This is the default.

0: disables the exploit of the key.

–session-savedb: to store session data in the database.

files: to store session data in the file system.

–key1: state a key to encrypt sensitive data in the Magento database.

0: Magento creates one for you.

–cleanup-databaseTo drop database tables before installing the Magento
–db-init-statementsAdvanced MySQL configuration parameter. Uses database initialization statements to run when connecting to the MySQL database.Ask a reference related to this one before you put any values.

Default is SET NAMES utf8;

–sales-order-increment-IntroductionIntroduction of sales order enhance IDno
–amqp-hostEnterprise Edition only. It doesn’t use the –amqp options unless you have already set up an installation of
–amqp-portEnterprise Edition only. The port to use to connect to
–amqp-userEnterprise Edition only. The user name for connecting to
–amqp-passwordEnterprise Edition only. The password for connecting to

The following commands are used to install Magento

php bin/magento setup:install --base-url= \

--db-host=localhost --db-name=magento --db-user=magento --db-password=magento \

--admin-firstname=Magento --admin-lastname=User [email protected] \

--admin-user=admin --admin-password=admin123 --language=en_US \

--currency=USD --timezone=America/Chicago --use-rewrites=1

I hope the following command defines you to install Magento  in Magento 2 command line CLI






Leave a Reply

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