How to install magento
How to install magento
Quick start install
We use Composer to manage Magento components and their dependencies. Using Composer to get the Magento software metapackage provides the following advantages:
You can also download an archive file for a specific version of Magento in either ZIP or TAR format. Installing Magento from an archive lacks the advantages of using Composer. Contributing developers should use the git-based installation method.
Prerequisites
Before you continue, you must do the following:
Log in as file system owner
Learn about ownership, permissions, and the file system owner in our Overview of ownership and permissions topic.
To switch to the file system owner:
Log in to the Magento server as, or switch to, a user with permissions to write to the Magento file system. See switch to the file system owner.
If you use the bash shell, you can use the following syntax to switch to the file system owner and enter the command at the same time:
If the file system owner does not allow logins, you can do the following:
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
Sample bash shell for CentOS:
Optionally, you can run the commands in the following ways:
In addition to the command arguments discussed here, see Common arguments.
Get the metapackage
To get the Magento metapackage:
Create a new Composer project using the Magento Open Source or Adobe Commerce metapackage.
Magento Open Source
Adobe Commerce
When prompted, enter your Magento authentication keys. Public and private keys are created and configured in your Commerce Marketplace.
See Troubleshooting for help with more errors.
Adobe Commerce customers can access 2.4.x and 2.3.x patches two weeks before the General Availability (GA) date. Pre-release packages are available through Composer only. You cannot access pre-releases on the Magento Portal or GitHub until GA. If you cannot find these packages in Composer, contact Adobe Commerce Support.
Minor releases contain new features, quality fixes, and security fixes. Use Composer to specify a minor release. For example, to specify the Adobe Commerce 2.4.3 metapackage:
Quality patches primarily contain functional and security fixes. However, they can also sometimes contain new, backward-compatible features. Use Composer to download a quality patch. For example, to specify the Adobe Commerce 2.4.3 metapackage:
Security patches contain security fixes only. They are designed to make the upgrade process faster and easier.
Set file permissions
You must set read-write permissions for the web server group before you install the Magento software. This is necessary so that the command line can write files to the Magento file system.
Install Magento
You must use the command line to install Magento.
For a full description of the CLI install options, refer to Install the Magento software from the command line.
Command summary
To display a complete list of commands, enter:
To get help for a particular command, enter:
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.
Command | Description | Prerequisites |
---|---|---|
magento setup:install | Installs the Magento software | None |
magento setup:uninstall | Removes the Magento software. | Magento software installed |
magento setup:upgrade | Updates the Magento software. | Deployment configuration |
magento maintenance: | Enables or disables maintenance mode (in maintenance mode, only exempt IP addresses can access the Admin or storefront). | Magento software installed |
magento setup:config:set | Creates or updates the deployment configuration. | None |
magento module: | Enable or disable modules. | None |
magento setup:store-config:set | Sets storefront-related options, such as base URL, language, timezone, and so on. | Deployment configuration |
Database (simplest way is to use magento setup:upgrade) | В | В |
magento setup:db-schema:upgrade | Updates the Magento database schema. | Deployment configuration |
magento setup:db-data:upgrade | Updates the Magento database data. | Deployment configuration |
magento setup:db:status | Checks if the database is up-to-date with the code. | Deployment configuration |
magento admin:user:create | 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) |
magento list | Lists all available commands. | None |
magento help | Provides help for the specified command. | None |
Common arguments
The following arguments are common to all commands. These commands can be run either before or after the Magento software is installed:
Hooray! You’ve completed the quick install. Need more advanced help? Check out our Advanced install guide.
Get the software
You are among the 240,000 merchants worldwide who put their trust in our eCommerce software. We have gathered some information to help you get started with Magento and with your Magento installation.
We have some resources here to help get you started using the eCommerce platform of the future—Magento 2.
How to get the Magento software
Check the availability of exciting new features and releases, and learn how you can obtain them, on our Magento product availability page.
Consult the following table for getting started with installing Magento Open Source or Adobe Commerce.
User needs | Description | High-level installation and upgrade steps | Get started link | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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, verify that you updated installation dependencies as discussed in Update installation dependencies.
Install the Magento software from the command line
The install command uses the following format:
The following tables describe the installation option names and values. For example installation commands. see Sample localhost installations.
Any options that contain spaces or special characters must be enclosed in either single or double quotes.
Admin credentials:
The following options specify the user information and credentials for the Admin user.
In Adobe Commerce version 2.2.8 and later, you can create the Admin user during or after installation. If you create the user during installation, all admin credential variables are required. See Sample localhost installations.
Site, database, and RabbitMQ configuration options:
Name | Value | Required? | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
—base-url | Base URL to use to access your Admin and storefront in any of the following formats: Note: The scheme (http:// or https://) and a trailing slash are both required. is the docroot-relative path in which to install the Magento software. Depending on how you set up your web server and virtual hosts, the path might be magento2 or it might be blank. 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 admin, backend, and so on. The Admin URI can contain alphanumeric values and the underscore character ( _ ) only. | No | ||||||||||
—db-host | Use any of the following: — The database server’s fully qualified hostname or IP address. — localhost (default) or 127.0.0.1 if your database server is on the same host as your web server.localhost means the MySQL client library uses UNIX sockets to connect to the database. 127.0.0.1 causes the client library to use the TCP protocol. For more information about sockets, see the PHP PDO_MYSQL documentation. Note: You can optionally specify the database server port in its hostname like www.example.com:9000 | Yes | ||||||||||
—db-name | Name of the Magento database instance in which you want to install the Magento database tables. 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 | ||||||||||
—db-ssl-key | Path to the client key. | No | ||||||||||
—db-ssl-cert | Path to the client certificate. | No | ||||||||||
—db-ssl-ca | Path to the server certificate. | 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 magento info:language:list from the bin directory.) | 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 magento info:currency:list from the bin directory.) | 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 magento info:timezone:list from the bin directory.) | 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 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 Admin and storefront in the following format: http[s]:// / / | No | ||||||||||
—use-secure-admin | 1 means you use SSL to access the 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 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 | Use any of the following: — db to store session data in the database. Choose database storage if you have a clustered database; otherwise, there might not be much benefit over file-based storage. — files to store session data in the file system. File-based session storage is appropriate unless the Magento file system access is slow, you have a clustered database, or you want to store session data in Redis. — redis to store session data in Redis. If you will be using Redis for default or page caching, Redis must be already installed. See Use Redis for session storage for additional information about configuring support for Redis. | 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. | Yes | ||||||||||
—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. Lock configuration options:
|