Get started with the command-line installation
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.
- After you log in to the Magento server, switch to a user that has permissions to write to the Magento file system. One way to do this is discussed in switch to the Magento file system owner.
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
- Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.
If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:
1 su <Magento file system owner> -s /bin/bash -c <command>
If the Magento file system owner does not allow logins you can do the following:
1 sudo -u <Magento file system owner> <command>
- To run Magento commands from any directory, add
<magento_root>/binto your system
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
bash shell example for CentOS:
1 export PATH=$PATH:/var/www/html/magento2/bin
You can also run the commands in the following ways:
cd <magento_root>/binand run them as
./magento <command name>
<magento_root>/bin/magento <command name>
<magento_root>is a subdirectory of your web server’s docroot. Need help locating the docroot?
In addition to the command arguments discussed here, see Common arguments.
The following table summarizes the available commands. Commands are shown in summary form only; for more information about a command, click the link in the Command column.
||Installs the Magento software||None|
||Removes the Magento software.||Magento software installed|
||Updates the Magento software.||Deployment configuration|
||Enables or disables maintenance mode (in maintenance mode, only exempt IP addresses can access the Magento Admin or storefront).||Magento software installed|
||Creates or updates the deployment configuration.||None|
||Enable or disable modules.||None|
||Sets storefront-related options, such as base URL, language, timezone, and so on.||Deployment configuration|
|Database (simplest way is to use magento setup:upgrade)|
||Updates the Magento database schema.||Deployment configuration|
||Updates the Magento database data.||Deployment configuration|
||Checks if the database is up-to-date with the code.||Deployment configuration|
||Creates a Magento administrator.||All of the following:
Enable at minimum the Magento_User and Magento_Authorization modules
Database (simplest way is to use magento setup:upgrade)
||Lists all available commands.||None|
||Provides help for the specified command.||None|
To display a complete list of commands, enter:
1 magento list
To get help for a particular command, enter:
1 magento help <command>
1 magento help setup:install
1 magento help cache:enable
The following arguments are common to all commands. These commands can be run either before or after the Magento software is installed:
|Long version||Short version||Meaning|
||Get help for any command. For example,
||Quiet mode; no output.|
||No interactive questions.|
||Verbosity level. For example,
||Display this application version|
||n/a||Force ANSI output|
||n/a||Disable ANSI output|