Quick start on-premises installation
The instructions on this page describe how to install Adobe Commerce and Magento Open Source on self-hosted infrastructure. For guidance on upgrading an existing installation, see the Upgrade Guide.
Adobe uses Composer to manage Adobe Commerce and Magento Open Source components and their dependencies. Using Composer to get the Adobe Commerce and Magento Open Source metapackage provides the following advantages:
- Reuse third-party libraries without bundling them with source code
- Reduce extension conflicts and compatibility issues by using a component-based architecture with robust dependency management
- Adhere to PHP-Framework Interoperability Group (FIG) standards
- Repackage Magento Open Source with other components
- Use the Adobe Commerce or Magento Open Source software in a production environment
Prerequisites
Before you continue, you must do the following:
- Complete all prerequisite tasks.
- Install Composer.
- Get authentication keys to the Adobe Commerce and Magento Open Source Composer repository.
Log in as file system owner
Learn about ownership, permissions, and the file system owner in the Overview of ownership and permissions topic.
To switch to the file system owner:
-
Log in to the application server as, or switch to, a user with permissions to write to the file system.
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:
code language-bash su <file system owner> -s /bin/bash -c <command>
If the file system owner does not allow logins, you can do the following:
code language-bash sudo -u <file system owner> <command>
-
To run CLI commands from any directory, add
<app_root>/bin
to your systemPATH
.Because shells have differing syntaxes, consult a reference like unix.stackexchange.com.
Sample bash shell for CentOS:
code language-bash export PATH=$PATH:/var/www/html/magento2/bin
Optionally, you can run the commands in the following ways:
cd <app_root>/bin
and run them as./magento <command name>
app_root>/bin/magento <command name>
<app_root>
is a subdirectory of your web server docroot
Get the metapackage
To get the Adobe Commerce or Magento Open Source metapackage:
-
Log in to your application server as, or switch to, the file system owner.
-
Change to the web server docroot directory or a directory that you have configured as a virtual host docroot.
-
Create a Composer project using the Adobe Commerce or Magento Open Source metapackage.
Magento Open Source
code language-bash composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name>
Adobe Commerce
code language-bash composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition <install-directory-name>
When prompted, enter your authentication keys. Public and private keys are created and configured in your Commerce Marketplace.
note note NOTE When using a Composer auth.json
file or environment variable, you will not be prompted to enter your authentication keys.If you encounter errors, such as
Could not find package...
or...no matching package found
, make sure that there are no typos in your command. If you still encounter errors, you may not be authorized to download Adobe Commerce. Contact Adobe Commerce Support for help.See Troubleshooting for help with more errors.
Example - Minor release
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.6 metapackage:
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.6 <install-directory-name>
Example - Quality patch
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.6 metapackage:
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.6 <install-directory-name>
Example - Security patch
Security patches contain security fixes only. They are designed to make the upgrade process faster and easier.
Security patches use the Composer naming convention 2.4.6-px
. Use Composer to specify a patch. For example, to download the Adobe Commerce 2.4.6-p1 metapackage:
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.4.6-p1 <install-directory-name>
Set file permissions
You must set read-write permissions for the web server group before you install Adobe Commerce or Magento Open Source. This is necessary so that the command line can write files to the file system.
cd /var/www/html/<magento install directory>
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data . # Ubuntu
chmod u+x bin/magento
Install the application
You must use the command line to install Adobe Commerce or Magento Open Source.
This example assumes that the install directory is named magento2ee
, the db-host
is on the same machine (localhost
), and that the db-name
, db-user
, and db-password
are all magento
:
bin/magento setup:install \
--base-url=http://localhost/magento2ee \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=opensearch \
--opensearch-host=os-host.example.com \
--opensearch-port=9200 \
--opensearch-index-prefix=magento2 \
--opensearch-timeout=15
--backend-frontname
option. However, Adobe recommends omitting this option and allowing the installation command to automatically generate a random URI. A random URI is harder for hackers or malicious software to exploit. The URI displays in your console when installation is complete.Command summary
To display a complete list of commands, enter:
bin/magento list
To get help for a particular command, enter:
bin/magento help <command>
For example:
bin/magento help setup:install
bin/magento help cache:enable
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.
magento setup:install
magento setup:uninstall
magento setup:upgrade
magento maintenance:{enable/disable}
magento setup:config:set
magento module:{enable/disable}
magento setup:store-config:set
magento setup:db-schema:upgrade
magento setup:db-data:upgrade
magento setup:db:status
magento admin:user:create
Deployment configuration
Enable at minimum the
Magento_User
and Magento_Authorization
modulesDatabase (simplest way is to use
bin/magento setup:upgrade
)magento list
magento help
Common arguments
The following arguments are common to all commands. These commands can be run either before or after the application is installed:
--help
-h
./magento help setup:install
or ./magento help setup:config:set
.--quiet
-q
--no-interaction
-n
--verbose=1,2,3
-v, -vv, -vvv
--verbose=3
or -vvv
displays debug verbosity, which is the most verbose output. Default is --verbose=1
or -v
.--version
-V
--ansi
--no-ansi