How to Update Magento 2 Version

Magento is an open source and one of the fastest growing ecommerce platforms. Hundreds of thousands of merchants around the world use it for their online stores, and one of the reasons is that Magento is loaded with many awesome features.

Speed and performance is an important factor in running a successful ecommerce store. Many store owners complain about both. However, this issue can be solved by hosting Magento on managed cloud hosting, like Cloudways. And the reason is simple: Magento does not compromise in either department.

Advantages of Magento

There are many advantages of Magento, and few of them are:

  • Highly Customizable
  • Scalable and Flexible
  • SEO Optimization
  • Huge Extension Library
  • Secure

Due to its popularity, Magento is releasing updates day-by-day. They do this to add more functionality, find bug fixes, improve security, enhance performance and much more. To utilize the latest features and to make your store more secure, updating your Magento is crucial. Magento has two versions: Magento 1.x and Magento 2.x.

Today, I am going to teach you how to update Magento 2 version. It is highly recommended that you use Command-Line Interface (CLI) to update Magento 2 which will save your’s lot of time. So I will update Magento 2 using composer.

Let’s Start!

Launch SSH

Launch an SSH terminal and connect it to your web server.  After connecting, go to the root directory of your Magento 2 store. You can use PuTTY for this step.

Run Commands

After getting into the Magento 2 root directory, you have to run some commands to update your Magento 2. The latest version of Magento 2 is 2.1.4. Hence, first I’m going to upgrade my current version to 2.1.4.

To do so, run the following command:

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

Now update your composer by running the following command:

composer update

Now remove the cache by running the following commands:

rm -rf var/di/* var/generation/*
php bin/magento cache:clean
php bin/magento cache:flush

Note:  if you are using cache storage other than Magento 2 filesystem, you will need to clear it manually.

Now upgrade the setup:

php bin/magento setup:upgrade

To do compilation, run this command:

php bin/magento setup:di:compile

Only reindexing is required now. Run the following command to reindex:

php bin/magento indexer:reindex

Now run the following command to check the updated version of your Magento 2 store:

php bin/magento --version

Note: If you have cloned Magento 2 from GIT repository, this method won’t work for you.

Final Words:

To use more functionalities, new features, and to make your Magento 2 store more secure, updating it is necessary. By following this step by step guide, you should now be able to update Magento 2 using composer. If you have any questions about the tutorial above or would like to share your thoughts, just leave a comment below.

Syed Muneeb Ul Hasan is an active contributor at Magenticians. He is an expert in PHP and Magento and prefers to educate users in the implementation of Magento. When not working, he loves to play games and watch cricket.