3.3 (65%) 4 votes

Part 8: Install Magento

Welcome to our serial articles on Magento 2 Command Lines (CLI)!

You know Magento 2 has provided the powerful command-line interface tool (CLI). It allows you to perform tasks including installation, configuration, database backups, compiling LESS etc. Today I will show you how to install Magento using command line. This solution is really faster than installing Magento via browser. Before starting this guide, please review our previous posts.

Install Magento using command line

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

The options and values are listed in table below

Option Value Required
–admin-firstname Magento admin first name yes
–admin-lastname Magento admin last name yes
–admin-email Magento admin email yes
–admin-user Magento admin user name yes
–admin-password Magento admin password

The password must be at least 7 characters in length and must include at least one alphabetic and at least one numeric character.

yes
–base-url Base URL to use to access your Magento Admin and storefront. It must point to Magento install dir.

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

no
–backend-frontname Uniform Resource Identifier (URI) to access the Magento Admin or omit this parameter to let Magento generate a random URI for you.

For example: admin, admin_123, admin_x67, etc.

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

The default value is localhost (127.0.0.1)

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

Default value is magento2

no
–db-user User name of database which is used to install Magento.

Default value is root

no
–db-password The password of db-user no
–db-prefix The prefix of tables in Magento db no
–language Language code to use in the Admin and storefront.

Use command below to see the list of language code:

php bin/magento info:language:list

no
–currency Default currency to use in the storefront

Use command below to see the list of currency:

php bin/magento info:currency:list

no
–timezone Default time zone to use in the Admin and storefront

Use command below to see the list of timezone:

php bin/magento info:timezone:list

no
–use-rewrites 1: means you use web server rewrites for generated links in the storefront and Admin.

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

no
–use-secure 1: enables the use of Secure Sockets Layer (SSL) in all storefront URLs. Make sure your web server supports SSL before you select this option.

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

no
–base-url-secure Secure base URL to use to access your Magento Admin and storefront no
–use-secure-admin 1: means you use SSL to access the Magento Admin. Make sure your web server supports SSL before you select this option.

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

no
–admin-use-security-key 1: causes the Magento software to use a randomly generated key value to access pages in the Magento Admin and in forms. These key values help prevent cross-site script forgery attacks. This is the default.

0: disables the use of the key.

no
–session-save db: to store session data in the database.

files: to store session data in the file system.

no
–key If you have one, specify a key to encrypt sensitive data in the Magento database. If you don’t have one, Magento generates one for you. no
–cleanup-database To drop database tables before installing the Magento software. no
–db-init-statements Advanced MySQL configuration parameter. Uses database initialization statements to run when connecting to the MySQL database. Consult a reference similar to this one before you set any values.

Default is SET NAMES utf8;

no
–sales-order-increment-prefix Prefix of sales order increment Id. no
–amqp-host Enterprise Edition only. Do not use the –amqp options unless you have already set up an installation of RabbitMQ. no
–amqp-port Enterprise Edition only. The port to use to connect to RabbitMQ. no
–amqp-user Enterprise Edition only. The user name for connecting to RabbitMQ. no
–amqp-password Enterprise Edition only. The password for connecting to RabbitMQ. no

Below is the examples of commands using to install Magento:

 

Your Magento website needs a powerful Magento ERP for stock control.

DON'T MISS THE CHANCE!

magento erp

How to Set up Multiple Websites with Apache - Magento 2.3
How to Create Customer and Add Address Programmatically - Magento 2.3