Question

What steps do I need to follow to upgrade a demo installation with sample data from Magento 2.1 to the latest 2.2 version?

Instructions that work for Magento Commerce (Enterprise Edition) as well as Open Source (Community Edition) if possible.

Was it helpful?

Solution

  1. Remove Magento 2.1 sample data modules:

    bin/magento sampledata:remove
    

    If you recieve an authentication error like this:

    [Composer\Downloader\TransportException]                                   
    
    The 'https://repo.magento.com/packages.json' URL required authentication.  
    You must be using the interactive console to authenticate                  
    

    you have to copy your stored credentials for repo.magento.com to var/composer_home because this is the composer home directory for bin/magento commands

    cp ~/.composer/auth.json var/composer_home/
    
  2. Specify new Magento version

    For Open Source (CE):

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

    For Commerce (EE):

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

    (Replace 2.2.1 with the current version if there's a newer one)

  3. Update dev requirement versions

    This is necessary if you use the testing tools bundled with Magento. The current required versions can be found here: https://github.com/magento/magento2/blob/2.2/composer.json#L76-L82

    composer require --dev --no-update \
        phpunit/phpunit ~6.2.0 \
        squizlabs/php_codesniffer 3.0.1 \
        pdepend/pdepend 2.5.0 \
        friendsofphp/php-cs-fixer ~2.1.1 \
        lusitanian/oauth ~0.8.10 \
        sebastian/phpcpd 2.0.4
    composer remove --dev --no-update \
        fabpot/php-cs-fixer \
        sjparkinson/static-review
    
  4. Trigger update

    composer update
    
  5. Review file permissions

    You might need to set the correct file permissions again, for example make bin/magento executable:

    chmod +x bin/magento
    

    And give appropiate write permissions to the new generated directory.

    More info: http://devdocs.magento.com/guides/v2.2/install-gde/install/file-sys-perms-over.html

  6. Reinstall sample data

    bin/magento sampledata:deploy
    bin/magento sampledata:reset
    
  7. Upgrade database

    bin/magento setup:upgrade
    
  8. Compilations

    If in production mode, also run the following compilation commands:

    bin/magento setup:di:compile
    bin/magento setup:static-content:deploy
    
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top