On November 17, 2015, Magento 2.0 was released (for general availability) to provide new ways to enhance user engagement, smoother navigation, improved conversion rates, greater security features, and better revenue generation for e-commerce store owners.
But the beginning was not as pleasant as Magento had thought. In the beginning, after the release, it was too much hectic to work on Magento 2. There were many flaws, bugs, and missing plugins. Everyone blamed Magneto 2 for being very slow (for sure, it was).
From Developer to Store owner, it was very difficult to decide and move to a whole new version of Magneto, which had many flaws, and was very slow in terms of site speed. Yes, it had many advancements compared to Magneto 1, but still, there were security flaws that hampered development and site speed in its initial days.
Then Magneto team worked really hard and continuously released new versions, patches, and security features very frequently, fixing all the issues they found and customers reported. Now Magneto 2 is a very fast and secure e-commerce application compared to Magento 1 or any other e-commerce shopping carts.
So, the moral of the story is that you must keep your Magento 2 store up to date all the time to grab new features, stability, performance, and better security.
The current stable release of Magneto 2 is 2.2.5, at the time when we are writing this article. However, it is our assumption that the same article should work for future upgrades as well.
Let’s learn how to upgrade your store
Step 1. Back up your files and database.
Note: Always backup your files and database before attempting an upgrade.
Step 2. Turn on maintenance mode
To enable maintenance mode, run the following command from the terminal where the current Magento 2 is installed.
#php bin/magento maintenance:enable
It will create a new file var/.maintenance.flag.
Note: You can disable maintenance mode by running the following command in the terminal after the upgrade is successfully performed.
#php bin/magento maintenance:disable
Or you can remove var/.maintenance.flag to disable maintenance mode.
Step 3. Upgrade Magento 2 Version
Now there are 3 ways you can upgrade Magento
1. Using Composer through the terminal
2. From Admin through the Web Setup Wizard
3. By downloading Magneto 2 latest version and copying them over the old installation
We will discuss all these methods one by one here:
Method 1. Using Composer
Step 1. Log in to your Magento server as a root user, or switch to, the Magento file system owner.
Step 2. Change to the directory in which you had installed your current Magento 2.
For example,
cd /var/www/htdocs/www.xyz.com/
Step 3. Require the Magento package using Composer and update the dependencies.
#composer require –no-update #composer update
For example, to upgrade to Magento Open Source version 2.2.5, type this on your terminal:
#composer require magento/product-community-edition 2.2.5 –no-update
#composer update
Similarly, for upgrading Magento Enterprise Edition version 2.2.5, enter this on terminal:
#composer require magento/product-enterprise-edition 2.2.5 –no-update
#composer update
Step 4. It will ask you for authentication keys. You may obtain those at Magento marketplace, here is the link https://marketplace.magento.com/customer/accessKeys/
For this, log in to your Magento account, go to your profile, click on the Access key under Marketplace Tab, and generate a new key.
Note: username is a public key, and password is a private key
Step 5. Remove var and generated folder
rm -rf var/ generated/
Step 6. Update the database schema and data through
#php bin/magento setup:upgrade
Step 7. As discussed previously cancel maintenance mode
#php bin/magento maintenance:disable
Step 8. Reset all file system ownership and permissions and you are done with upgrading your store from 2.x to latest 2.2.5
Method 2. Using Setup Wizard From Admin
The Setup Wizard is a feature in the admin interface that can be used to easily install and uninstall components, modules, and extensions, manage modules, upgrade installation, and make changes to the Web setup of your installation.
So, we can do many other important things from setup wizard, including upgrading Magento.
Step 1. Go to System => Tools => Web Setup Wizard in Admin
Then click on System Upgrade.
Step 2. It will ask you for authentication keys. You may obtain those at Magento marketplace (same as you did in the previous method with Step IV). Here is the link
https://marketplace.magento.com/customer/accessKeys/
Step 3. Select Magneto version from dropdown to which you want to upgrade
Step 4. In this step, you may need to upgrade the php and install some php extensions. If all is good, you may proceed further.
If there are any issues, then resolve them, and then you will be able to proceed further.
Step 5. Create a Backup if you haven’t already. We recommend doing backup on the first step as at this step it may take more time and resources, and sometimes it may hang the system, so you need to close and start all over again.
Step 6. The final step is a system upgrade. Click on Upgrade, and your upgrade will start.
Once finished, you should be able to see the following screen
Method 3. By Downloading Magento 2 Latest Version And Copying Them Over Old Installation
This is the least recommended method, but useful if, unfortunately, you were not able to upgrade through the previous two methods.
For this, you have to download the latest version of Magento 2 from the official website and then paste it to the Magento root folder. It will overwrite the core files with new ones and then upgrade your setup by the following command.
#php bin/magento setup:upgrade
This will upgrade the database and then
#php bin/magento setup:static-content:deploy
To deploy static content, set file permission, and you are ready with an upgraded setup.
Soon, I will put some FAQs which will help you troubleshoot some known bugs or issues you encounter during the upgrade of your M2 to M2 2.2.5. Stay tuned.
Do not forget to ask your questions.BIZSPICE.com can help you upgrade your Magento version 2.x store. Let us know if we can help you upgrade your Magento store and make it perform better, more secure, and fast. You can also read the details about our Magento Upgrade Service here.