Close [x]

Set up the updater

Edit this page on GitHub

Contents

Overview of the updater

The updater synchronizes with Magento Connect for updating components and upgrading the Magento software. Contributing developers must clone the updater GitHub repository and copy the files to <your Magento install dir>/update’’

This topic is for contributing developers only; that is, anyone who clones the Magento 2 GitHub repository so they can contribute to the Magento 2 codebase. If you did not clone the Magento repository, you should skip this topic.

Cloning the updater repository

You can clone the Magento 2 Updater repository using either SSH or HTTPS protocols:

  • Use SSH for better security (no user name and password are exchanged). This requires you to share a public key with GitHub.
  • Use HTTPS if you don’t share an SSH key with GitHub (your user name and password are encrypted before being sent to GitHub).

See one of the following section:

Clone with SSH

To clone the Magento 2 Updater repository using the SSH protocol:

  1. Copy to the clipboard the Magento 2 Updater repository SSH clone URL.

    a. In a web browser, go to the Magento 2 Updater repository.

    b. On the right side of the page, under the clone URL field, click SSH.

    c. Click the Copy to clipboard button.

    The following figure shows an example.

    Clone the Magento 2 Updater repository using SSH

  2. Change to your web server’s docroot directory.

    Typically, for Ubuntu, it’s /var/www and for CentOS it’s /var/www/html.

    Need help locating the docroot? Click here.

  3. Enter the following command:

    git clone git@github.com:magento/magento2-updater.git
    
  4. Wait for the repository to clone on your server.

    If the following error displays, make sure you shared your SSH key with GitHub:

    Cloning into 'magento2'...
    Permission denied (publickey).
    fatal: The remote end hung up unexpectedly
  5. Continue with Update installation dependencies.

Clone with HTTPS

To clone the Magento 2 Updater repository using the HTTPS protocol:

  1. Copy to the clipboard the Magento 2 Updater repository HTTPS clone URL.

    a. In a web browser, go to the Magento 2 Updater repository.

    b. On the right side of the page, under the clone URL field, click HTTPS.

    c. Click the Copy to clipboard button.

    The following figure shows an example.

    Clone the Magento 2 Updater repository using HTTPS

  2. Change to your web server’s docroot directory.

    Typically, for Ubuntu, it’s /var/www and for CentOS it’s /var/www/html.

  3. Enter the following command:

    git clone https://github.com/magento/magento2-community-edition.git
    

    If the command fails with an authentication error, try

    git clone https://<your GitHub user name>:<your password>@github.com/magento//magento2-community-edition.git
    
  4. Wait for the repository to clone on your server.

  5. Continue with the next section.

Update installation dependencies

The updater application has dependencies specified in its composer.json file. To update it, you must authentication. The composer install commands fails if you do not. To authenticate, generate authentication keys, after which you create an auth.json file in the home directory of the Magento file system owner.

Generate authentication tokens

To get your authentication keys:

  1. If you haven’t done so already, create an account on Magento Connect.

    (It’s the same as an account on magento.com.)

    • Click My Account in the upper right corner of the page.
    • In the New Customer section, click Register.

      If you already have an account, make sure you know your user name and password, then continue with the next step.

  2. At the top of the page, click Connect.
  3. In the Developers section, click Secure Keys.

  4. You have the following options in the right pane:

    • If you already have keys, use the Public key as your user name and the Private key as your password.
    • New key: In the Name field, enter a name to identify the keys and click Generate new.

      You can optionally generate additional keys; for example, to provide access to repo.magento.com to co-workers, contractors, or integrators.

    • Regenerate or rename existing keys: Click Regenerate.

      You can regenerate your keys for security reasons; for example, you believe they have been compromised.

    • Save an existing key if you changed its name: Click Save.
    • Disable keys: Click Disable. You can do this if you want to suspend use of your keys.
    • Delete keys: Click Delete.
  5. Come back to this page anytime to view or change your keys.

Create auth.json

To create auth.json:

  1. Log in to your Magento server as, or switch to, the Magento file system owner.
  2. Edit or create auth.json in the user’s home directory.

    The following example shows how to add repo.magento.com authentication to an existing file:

    {
       "github-oauth": {
         "github.com": "<your github oauth id>"
       },
       "http-basic": {
          "repo.magento.com": {
             "username": "<public key>",
             "password": "<private key>"
          }
       }
    }
    
    For example, if your user name is magento_user, create or edit /home/magento_user/.composer/auth.json

Resolve updater dependencies

Before you continue, resolve those dependencies as follows:

  1. Change to the directory to which you cloned the updater application.
  2. As a user with permissions to write to the directory, enter

    composer install
    

    Wait for dependencies to resolve and continue with the next section.

Copy the files

As a user with privileges to write files to the Magento file system, enter the following command:

mkdir -p <your Magento install dir>/update
cp -R <updater-clone-directory>/* <your Magento install dir>/update

For example, if you cloned the updater to /var/www/html/magento2-community-edition and Magento is installed in /var/www/html/magento2, enter

mkdir -p /var/www/html/magento2/update
cp -R /var/www/html/magento2-community-edition/* /var/www/html/magento2/update

Next step