How to Update Magento 2 Using Composer
Update Magento 2
Step 1 -> First of all, connect to your web server via SSH. Using putty or any SSH client, log in to your Magento 2 server with full file system ownership.
Step 2 -> Once your SSH connection is established, you will need to navigate to your Magento 2 ROOT directory.
Step 3 -> Now follow the order and use the following commands:
composer require magento/product-community-edition 2.1.3 --no-update
2.1.3 is the latest version of Magento 2.1.x version. If you want to upgrade Magento 2.0.x version, change these numbers accordingly.
If an authentication prompted, enter your magento.repo authentication keys.
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/* php bin/magento cache:clean php bin/magento cache:flush
In case, if you are using cache storage other than Magento 2 filesystem (e.g. Varnish, Redis, Memcached, etc.), you will need to manually clear that cache too.
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento indexer:reindex
Step 4 -> Now go to your Magento 2 Admin Panel and at the bottom right corner, verify that you have successfully updated your Magento 2 version. If any error displays, try resetting your file permissions and clear the cache again.
bin/magento maintenance:enable composer require magento/product-community-edition 2.2.0 --no-update composer update rm -rf var/cache/* rm -rf var/page_cache/* rm -rf var/generation/* chmod +x bin/magento bin/magento setup:upgrade bin/magento maintenance:disable
For further upgrades, change the version number:
composer require magento/product-community-edition 2.2.2 --no-update
Why Should You Update Magento 2?
Here are 8 reasons why you really should:
- Security Updates
- UI Updates
- Functionality Improvement
- Bug Fixes
- Performance Improvement
- Support for the Latest Technology Stack
- Catalog, Products, Shipping & Calculation Improvements
- Integration Improvement with 3rd-Party Services like Google Analytics, Payment Methods, Gateways, etc.