How to Update Magento 2 Using Composer

Disclaimer: Magenticians does not necessarily agree with the views expressed in this guest post. They are presented to bring to light all diverse views in the Magento and general ecommerce community.

Launched by Varien in 2007, Magento has now become one of the fastest growing ecommerce platforms. With a combination of several excellent and latest ecommerce features, it has crafted its worth in the modern ecommerce industry. And if you use the popular CMS and you’re wondering how to update Magento 2 using Composer, then we have you covered!

Today, Magento is the primary choice as an ecommerce platform for more than 250,000 online stores because of its modular architecture, complete scalability, and the wide range of support and options.

Discussions about the various issues people were facing while using Magento had started the day Magento 2 was released. But several experts came up with their exceptional opinions about the platform and made a huge impact on the Magento 2’s improvement. However, people still run into problems during its installation or get stuck in other procedures!

Like other ecommerce platforms, Magento keeps coming up with updates to allow compatibility with industry trends and all users. This is why it is highly recommended that you always keep an up-to-date version of Magento.

There are several features in Magento 2 that we are familiar with. Magento 2 Command-Line Interface (CLI) is one of the best and saves a lot of time for developers in playing with module management, index management, cache management, and updating to the latest Magento 2 version, etc.

Today, we are going to explain how to upgrade Magento 2 version using CLI. Keep in mind that you should create a backup of your store first because it’s not recommended to use this method on your live store.

Also, you should know that Magento 2 CLI upgrade only works if you have installed your Magento 2 by using Composer or the archived ZIP file downloaded from the official Magento website. If you have cloned Magento 2 from GIT repository, this method won’t work for you.

Update Magento 2

So let’s dig into the upgrade procedure of Magento 2 by following these simple steps:

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

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.

Conclusion

There are multiple ways to update Magento 2. In the above method, we have used Magento 2 CLI to perform this task. It’s a precise and useful guide to upgrade Magento 2 using Composer quickly. Feel free to leave me a message or email me anytime if you face any issue and need some extra help.

About Author

Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. He contributes as a Guest Author at Magenticians to share his knowledge with the Magento Community. Fayyaz is a food lover and enjoys driving.