Install the Magento software
Totally lost? Need a helping hand? Try our installation quick reference (tutorial) or installation roadmap (reference).
Before you start your installation
Before you begin, make sure that:
- Your system meets the requirements discussed in Magento system requirements.
- You completed all prerequisite tasks discussed in Prerequisites.
- You took your first installation steps as discussed in Your install or upgrade path.
- After you log in to the Magento server, switch to the Magento file system owner.
- Review the information discussed in Get started with the command-line installation.
You must install Magento from its bin
subdirectory.
The installer is designed to be run multiple times if necessary so you can:
-
Provide different values
For example, after you configure your web server for Secure Sockets Layer (SSL), you can run the installer to set SSL options.
- Correct mistakes in previous installations
- Install Magento in a different database instance
By default, the installer doesn't overwrite the Magento database if you install the Magento software in the same database instance. You can use the optional cleanup-database
parameter to change this behavior.
See also Update, reinstall, uninstall.
Completely secure installation
To use Secure Sockets Layer (SSL), also referred to as HTTPS, for both the Magento Admin and the storefront, you must set all of the following parameters:
--use-secure
: Set to1
--base-url-secure
: Set to a secure URL (that is, starting withhttps://
)--use-secure-admin
Set to1
More details about these parameters can be found later in this topic.
Installer help commands
You can run the following commands to find values for some required arguments:
Installer argument | Command |
---|---|
Language | magento info:language:list |
Currency | magento info:currency:list |
Time zone | php magento info:timezone:list |
If an error displays when you run these commands, make sure you updated installation dependencies as discussed in Update installation dependencies.
Install the Magento software from the command line
The format of the install command follows:
magento setup:install --<option>=<value> ... --<option>=<value>
The following table discusses the meanings of installation option names and values. Examples are provided in Sample localhost installations.
Any options that contain spaces or special characters must be enclosed in either single or double quotes.
Name | Value | Required? |
---|---|---|
--admin-firstname |
Magento administrator user's first name. |
Yes |
--admin-lastname |
Magento administrator user's last name. |
Yes |
--admin-email |
Magento administrator user's e-mail address. |
Yes |
--admin-user |
Magento administrator user name. |
Yes |
--admin-password |
Magento administrator user password. The password must be at least 7 characters in length and must include at least one alphabetic and at least one numeric character. We recommend a longer, more complex password. Enclose the entire password string in single quotes. For example, |
Yes |
--base-url |
Base URL to use to access your Magento Admin and storefront in any of the following formats:
|
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. We recommend a random URI for security purposes. A random URI is harder for hackers or malicious software to exploit. The URI displays at the end of the installation. You can display it later at any time using the magento info:adminuri command. If you choose to enter a value, we recommend you not use a common word like |
No |
--db-host |
Use any of the following:
Note: You can optionally specify the database server port in its host name like |
No |
--db-name |
Name of the Magento database instance in which you want to install the Magento database tables. Default is |
No |
--db-user |
User name of the Magento database instance owner. Default is |
No |
--db-password |
Magento database instance owner's password. |
No |
--db-prefix |
Use only if you're installing the Magento database tables in a database instance that has Magento tables in it already. In that case, use a prefix to identify the Magento tables for this installation. Some customers have more than one Magento instance running on a server with all tables in the same database. The prefix can be a maximum of five characters in length. It must begin with a letter and can include only letters, numbers, and underscore characters. This option enables those customers to share the database server with more than one Magento installation. |
No |
--language |
Language code to use in the Admin and storefront. (If you have not done so already, you can view the list of language codes by entering |
No |
--currency |
Default currency to use in the storefront. (If you have not done so already, you can view the list of currencies by entering |
No |
--timezone |
Default time zone to use in the Admin and storefront. (If you have not done so already, you can view the list of time zones by entering |
No |
--use-rewrites |
|
No |
--use-secure |
|
No |
--base-url-secure |
Secure base URL to use to access your Magento Admin and storefront in the following format:
http[s]://<host or ip>/<your Magento install dir>/
|
No |
--use-secure-admin |
|
No |
--admin-use-security-key |
|
No |
--session-save |
Use any of the following:
|
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, specify this parameter without a value. Otherwise, the Magento database is left intact. |
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 |
No |
--sales-order-increment-prefix |
Specify a string value to use as a prefix for sales orders. Typically, this is used to guarantee unique order numbers for payment processors. |
No |
--amqp-host |
Magento Commerce only. Do not use the `--amqp` options unless you have already set up an installation of RabbitMQ. See RabbitMQ installation for more information about installing and configuring RabbitMQ. The host name where RabbitMQ is installed. |
No |
--amqp-port |
Magento Commerce only. The port to use to connect to RabbitMQ. The default is |
No |
--amqp-user |
Magento Commerce only. The user name for connecting to RabbitMQ. Do not use the default user |
No |
--amqp-password |
Magento Commerce only. The password for connecting to RabbitMQ. Do not use the default password |
No |
To enable or disable modules after installing Magento, see Enable and disable modules.
What is sensitive data?
Magento uses your encryption key to encrypt the following:
- Credit card information
- User names and passwords specified in the Magento Admin configuration (for example, logins to payment gateways)
- CAPTCHA values sent over the network
Magento does not encrypt:
- Administrative and customer user names and passwords (these passwords are hashed)
- Address
- Phone number
- Other types of personally identifiable information except for credit card numbers
Sample localhost installations
Example 1
The following example installs Magento with the following options:
-
The Magento software is installed in the
magento2
directory relative to the web server docroot onlocalhost
and the path to the Magento Admin isadmin
; therefore:Your storefront URL is
http://127.0.0.1
-
The database server is on the same host as the web server.
The database name is
magento
, and the user name and password are bothmagento
-
Uses server rewrites
-
The Magento administrator has the following properties:
- First and last name are
Magento User
- User name is
admin
and the password isadmin123
- E-mail address is
user@example.com
- First and last name are
- Default language is
en_US
(U.S. English) - Default currency is U.S. dollars
-
Default time zone is U.S. Central (America/Chicago)
magento setup:install --base-url=http://127.0.0.1/magento2/ \ --db-host=localhost --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=admin123 --language=en_US \ --currency=USD --timezone=America/Chicago --use-rewrites=1
Messages similar to the following display to indicate a successful installation:
Post installation file permissions check...
For security, remove write permissions from these directories: '/var/www/html/magento2/app/etc'
[Progress: 274 / 274]
[SUCCESS]: Magento installation complete.
[SUCCESS]: Admin Panel URI: /admin_puu71q
Example 2 (with additional options)
The following example installs Magento with the following options:
-
The Magento software is installed in the
magento2
directory relative to the web server docroot onlocalhost
and the path to the Magento Admin isadmin
; therefore:Your storefront URL is
http://127.0.0.1
-
The database server is on the same host as the web server.
The database name is
magento
, and the user name and password are bothmagento
-
The Magento administrator has the following properties:
- First and last name are is
Magento User
- User name is
admin
and the password isadmin123
- E-mail address is
user@example.com
- First and last name are is
- Default language is
en_US
(U.S. English) - Default currency is U.S. dollars
- Default time zone is U.S. Central (America/Chicago)
- The installer first cleans up the database before installing the tables and schema
- You use a sales order increment prefix
ORD$
and because it contains a special character ($
), the value must be enclosed in double quotes - Session data is saved in the database
-
Uses server rewrites
magento setup:install --base-url=http://127.0.0.1/magento2/ \ --db-host=localhost --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=admin123 --language=en_US \ --currency=USD --timezone=America/Chicago --cleanup-database \ --sales-order-increment-prefix="ORD$" --session-save=db --use-rewrites=1
Messages similar to the following display to indicate a successful installation:
Post installation file permissions check...
For security, remove write permissions from these directories: '/var/www/html/magento2/app/etc'
[Progress: 274 / 274]
[SUCCESS]: Magento installation complete.
[SUCCESS]: Admin Panel URI: /admin_puu71q
The command must be entered either on a single line or, as in the preceding example, with a \
character at the end of each line.
Next step
-
If you have one user account to access the Magento server, see Optionally set a umask.
This type of setup is typical for shared hosting.