How to upgrade Magento 2 to a later version

June 9th, 2017

Warning: This post is 6 years old. Some of this information may be out of date.

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

  1. Update the composer.json with the latest upgrade version:

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

  1. Update the files:

composer update

  1. Clear the var cache files:

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

  1. Update the Database:

php bin/magento setup:upgrade

  1. 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

  1. Turn off Maintenance mode:

php bin/magento maintenance:disable

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