Magento 2 Tutorials

How to Update Magento 2 Using Composer

How to Upgrade Magento 2 Version Banner

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.

Why Should You Update Magento 2?

One question, however, keeps rising: ‘Why should we 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.

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

composer update

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.

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.

Subscribe Newsletter

Subscribe to get latest Magento news

40% Off for 4 Months on Magento Hosting + 30 Free Migration