Update installation dependencies
Introduction to Magento installation dependencies
We now use Composer to resolve dependencies before you install the Magento software and extensions.
Composer is a separate application that manages PHP dependencies. Before you can install the Magento software, you must perform the following tasks in the order shown:
- Install the Composer software.
- Create the Magento file system owner so Composer writes files to the web server docroot as the correct user.
-
Run the
composer install
command from your Magento root directory (for example,/var/www/magento2/
).The Magento root directory is a subdirectory of your web server’s docroot. Need help locating the docroot? Click here.
If the following error displays, see troubleshooting:
file_get_contents(app/etc/NonComposerComponentRegistration.php): failed to open stream: No such file or directory
Copy
For you to be able to run the Magento application, make sure you perform all tasks as a user with privileges to write to the web server docroot. One way to do this is to log in as or switch to the >switch to the Magento file system owner.
Run composer install
to update dependencies
Update installation dependencies as follows:
- Log in to your Magento server as the Magento file system owner or switch to that user.
-
Change to the Magento installation directory and run
composer install
. Examples:CentOS:
cd /var/www/html/magento2 && composer install
CopyUbuntu:
cd /var/www/magento2 && composer install
CopyThis command updates package dependencies and can take a few minutes to complete.
The following error might display:
[Composer\Downloader\TransportException] The "https://repo.magento.com/archives/magento/composer/magento-composer-1.0.2.0.zip" file could not be downloaded (HTTP/1.1 404 Not Found)
CopyIf so, create
auth.json
in the Magento file system owner’s<home>/.composer
directory and runcomposer install
again.
Set pre-installation file system ownership and permissions
This topic discusses how to set read-write permissions for the web server group before you install the Magento software. This is necessary so the Setup Wizard or command line can write files to the Magento file system.
The procedure you use is different, depending on whether you use shared hosting and have one user or if you use a private server and have two users.
If you're using a Magento version earlier than 2.0.6, see Appendix—Magento file system ownership and appendix (legacy) instead.
Set permissions for shared hosting (one user)
This section discusses how to set pre-installation permissions if you log in to the Magento server as the same user that also runs the web server. This type of setup is common in shared hosting environments.
Set ownership and permissions for two users
This section discusses how to set ownership and permissions for your own server or a private hosting setup. In this type of setup, you typically cannot log in as, or switch to, the web server user. You typically log in as one user and run the web server as a different user.
Switch to the Magento file system owner
After you’ve performed the other tasks in this topic, enter one of the following commands to switch to that user:
- Ubuntu:
su <username>
- CentOS:
su - <username>
For example,
su magento_user
Next step
Install the Magento software: