Magento 2: Upgrade/Update using Command Line & Composer
This article shows how you can upgrade/update your Magento 2 version through command line using composer.
In this example, I am upgrading Magento 2 to version 2.1.1.
Here are commands to run on terminal/command-prompt:
1 2 3 4 5 6 7 | composer require magento/product-community-edition 2.1.1 --no-update composer update rm -rf var/di var/generation php bin/magento cache:flush php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento indexer:reindex |
Note: In Ubuntu/Debian Linux, if you are having permission issues then try using sudo at the beginning of every command. For example, sudo composer update
After you have upgraded Magento 2, you can check your Magento’s version with the following command:
1 | php bin/magento --version |
If you get cache write permission error when you browse your Magento site after upgrade, then run the following command to give write permission to pub and var directories:
1 | chmod -R 777 pub var |
Hope this helps.
Thanks.





Mukesh Chapagain is a graduate of Kathmandu University (Dhulikhel, Nepal) from where he holds a Masters degree in Computer Engineering. Mukesh is a passionate web developer who has keen interest in open source technologies, programming & blogging.