Skip to content

Latest commit

 

History

History
114 lines (78 loc) · 4.82 KB

cli-upgrade.md

File metadata and controls

114 lines (78 loc) · 4.82 KB
layout group subgroup title menu_title menu_node menu_order version github_link
default
compman
28_cli-upgr
Command-line upgrade
Command-line upgrade
parent
1
2.0
comp-mgr/cli/cli-upgrade.md

Command-line upgrade

You can upgrade Magento from the command line if you installed the software using any of the following:

  • Downloaded the metapackage using composer create-project
  • Installed the compressed archive
  • If you cloned the Magento 2 GitHub repository, you cannot use this method to upgrade; instead, see Update the Magento application.
  • If you configured Magento use use pub as its root directory, see the next section.
  • If you're upgrading to Magento 2.1 (including a Release Candidate) from Magento 2.0.7 or earlier and you installed sample data, see Command-line upgrade to Magento 2.1 with sample data instead of this topic.

Prerequisite: pub directory root {#upgrade-cli-pub}

This section applies to you only if you set the Magento root directory to <your Magento install dir>/pub. If you did not do this, skip this section and continue with the next section.

{% collapsible If you use pub as your Magento root directory: %}

  • For the upgrade, create another subdomain or docroot that uses the Magento installation directory as its root.

    Run the System Upgrade utility using that subdomain.

  • Use the following procedure to upgrade Magento using the command line.

{% endcollapsible %}

Put your store in maintenance mode {#upgrade-cli-maint}

To prevent access to your store while it's being upgraded, put your store in maintenance mode.

You can optionally create a custom maintenance mode page.

{% collapsible To enable maintenance mode: %}

  1. Log in to your Magento server as, or switch to, the Magento file system owner.

  2. Enter the following command:

    php <your Magento install dir>/bin/magento maintenance:enable
    

    For additional options, see Enable or disable maintenance mode.

{% endcollapsible %}

Upgrade using the command line {#upgrade-cli-upgr}

{% collapsible To upgrade using the command line: %}

  1. Log in to your Magento server as, or switch to, the Magento file system owner.

  2. Change to the directory in which you installed the Magento software.

    For example, cd /var/www/html/magento2

  3. Enter the following commands in the order shown:

    composer require <product> <version> --no-update
    composer update
    

    For example, to upgrade to Magento CE version 2.0.11, enter:

    composer require magento/product-community-edition 2.0.11 --no-update
    composer update
    

    To upgrade to Magento EE version 2.0.11, enter:

    composer require magento/product-enterprise-edition 2.0.11 --no-update
    composer update
    

    If an error displays about a missing .gitignore files, see the Technical Bulletin (1/28/16).

  4. If prompted, enter your authentication keys.

  5. Manually clear var subdirectories:

    rm -rf <Magento install dir>/var/cache/*
    rm -rf <Magento install dir>/var/page_cache/*
    rm -rf <Magento install dir>/var/generation/* 
    
  6. Update the database schema and data:

     php bin/magento setup:upgrade
    
  7. Restart Varnish if you use it for page caching.

    service varnish restart
    
  8. Access your storefront.

    The following error might display:

    We're sorry, an error has occurred while generating this email.
    

    If so, perform the following tasks:

    1. Reset file system ownership and permissions as a user with root privileges.

    2. Clear the following directories and try again:

      <your Magento install dir>/var/cache 
      <your Magento install dir>/var/page_cache 
      <your Magento install dir>/var/generation 
      

{% endcollapsible %}