How to upgrade Magento 2 to a later version

Image for How to upgrade Magento 2 to a later version from

By Andrew McCombe
June 9, 2017

Here's how to upgrade Magento 2 to a later version. For example, if you are currently running 2.1.6 and you need to upgrade to 2.1.7. Make sure you are in your Magento 2 public_html directory before you start.

1) Put your store in maintenance mode:

php bin/magento maintenance:enable

2) Update the composer.json with the latest upgrade version:

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

3) Update the files:

composer update

4) Clear the var cache files:

rm -fr var/{cache,page_cache,generation}/*

5) Update the Database:

php bin/magento setup:upgrade

6) Run Magento compile command:

php bin/magento setup:di:compile

If you get memory issues, run this with more memory:

php -d memory_limit=4G bin/magento setup:di:compile

7) Turn off Maintenance mode:

php bin/magento maintenance:disable

8) Revisit your site admin and check the version number in the footer.