Magento 2 is the combination of many excellent and latest features. It has created its unique place in the contemporary ecommerce industry. Before the release of Magento 2, developers and bloggers had started writing about the different issues they were facing while using RC editions of Magento 2 and their opinions about the platform made a great impact on its improvement.
But still, many people get stuck in the installation process of Magento 2 or some get trapped in other different procedures. Installation of Magento 2 is not a big problem, as we have seen lots of articles by our beloved Magento Community members. I suggest you first read “How To Install Magento 2” article to understand the easy process of Magento 2 installation.
There are many things about Magento 2 that you are familiar with. The CLI (Command-Line Interface) in Magento 2 is one of the best components of this version. It saves a lot of time for developers. With CLI, we can do many things with Magento 2, such as module management, upgrade to the version, etc. It is necessary and recommended that we should always keep an up-to-date version of Magento 2.
Upgrade Magento 2 Using CLI (Command-Line Interface)
In this blog post, I am going to show you how to upgrade Magento 2 using Command-Line Interface. Before we dig into this tutorial, you should know that upgrade via CLI only works if you have installed your Magento 2 by using the below methods:
- Installed Magento 2 using Composer.
- Installed Magento 2 using the archived ZIP file downloaded from official Magento website.
If you cloned the Magento 2 GIT repository, this tutorial is not for you. So, let’s start the upgrade procedure by following these simple steps:
- Using putty or any other source for SSH session, login to your Magento 2 server with full Magento 2 file system ownership.
- Navigate to the Magento 2 ROOT directory.
- Follow the order and use these following commands:
- composer requires magento/product-community-edition 2.0.7 –no-update
Note: 2.0.7 is the latest stable version of Magento 2. These numbers can be changed accordingly.
- composer update
Note: This command will ask your magento.repo authentication keys.
- rm -rf var/di var/generation
- php bin/magento setup:upgrade
- php bin/magento setup:di:compile
- php bin/magento cache:clean
- php bin/magento cache:flush
- php bin/magento indexer:reindex
4. When you are done, access your Magento 2 Admin Panel and at the bottom right corner, verify that you have successfully upgraded your Magento2.
Above is a precise but very necessary and useful tutorial to upgrade your Magento 2 quickly. If you face any problem, feel free to leave me a message or email me anytime.
Fayyaz Khattak is the Magento Community Manager at Cloudways – a managed Magento HostingPlatform. His objective is to learn & share about PHP & Magento Development in Community. He loves food and driving.Stay Connected: Email him at email@example.com or you can follow him on Twitter.