In its last year of being Magento’s flagship Community Edition product, Magento 1.9 had a lot of service upgrades and patches. There were at least 11 patches along with several other vendor specific updates that had to be done. Once those were done you had to visually review your site to make sure your block types were authorized. Several site owners reported that site features no longer appeared on their site, only leaving a blank. If this happen to you each block type had to be authorized individually potentially adding dozens of developer hours.
Fortunately, the core team of developers for Magento 2 addressed this issue in the latest installment. Previously, I explained how to install Magento 2, now I will explain how to upgrade magento 2 version. In Magento 2 you have two ways now to upgrade your site. Well, a third but it’s really just a caveat to the second one if you have sample data installed.
As it is with any Model View Controller (MVC) or Model View View Model (MVVM) framework it is highly important to follow convention. What happens if you don’t or if you “edit core” files is that the upgrades will override all of your hard work. So the idea is to make your own themes. It’s ok to simply copy the blank or Luma theme and start from there.
Let’s get down to the details. The first is the easiest. For those that are less technical or do not desire to get into the command line it can be done through the admin area. In this tutorial, we are going to upgrade Magento from 2.0.x to 2.1.x
Admin Area Upgrade
Navigate to System > Web Setup Wizard > System Upgrade
Once your in this area we have to do a couple things.
Step 1: Select your version.To keep this blog current I won’t identify which version to select but Magento will let you know the most current by putting the word (latest) in parenthesis next to the newest version.
Step 2: You will see a readiness check. Green means go.
Step 3: When ready press the upgrade button.
Terminal Area Upgrade
Before you start please apply the MDVA-532 patch, open your terminal and enter this:
1 2 | composer require magento/product-community-edition 2.1.0 --no-update Composer update |
Next enter the following line to update the database schema and data.
1 | php bin/magento setup:upgrade |
As with any upgrade you will need to validate your results and perform a quality assurance check. QA checks are best performed by several people so that things aren’t missed. Have people evaluate the whole process flow from the homepage all the way through checkout.
Earlier in this article I identified a caveat. If you started development with using Magento 2’s sample data then your only option is to use the terminal.
Terminal Area Upgrade if sample data was used
If sample data was had installed, you can only upgrade Magento 2 installation via terminal.
Note: Remember to back up your composer.json file before proceeding.
Enter the following into the terminal:
1 | composer require magento/product-community-edition 2.1.0 --no-update |
For this next piece, I have prepared for you, just copy and paste it to terminal:
1 | composer require magento/module-bundle-sample-data:100.1.0 magento/module-widget-sample-data:100.1.0 magento/module-theme-sample-data:100.1.0 magento/module-catalog-sample-data:100.1.0 magento/module-customer-sample-data:100.1.0 magento/module-cms-sample-data:100.1.0 magento/module-catalog-rule-sample-data:100.1.0 magento/module-sales-rule-sample-data:100.1.0 magento/module-review-sample-data:100.1.0 magento/module-tax-sample-data:100.1.0 magento/module-sales-sample-data:100.1.0 magento/module-grouped-product-sample-data:100.1.0 magento/module-downloadable-sample-data:100.1.0 magento/module-msrp-sample-data:100.1.0 magento/module-configurable-sample-data:100.1.0 magento/module-product-links-sample-data:100.1.0 magento/module-wishlist-sample-data:100.1.0 magento/module-swatches-sample-data:100.1.0 magento/sample-data-media:100.1.0 magento/module-offline-shipping-sample-data:100.1.0 --no-update |
Next, enter this line
1 | Composer update |
This will take some time as it is a big chunk of code. Once its done reset your file permissions.
1 | Php bin/magento setup:upgrade |
It goes without saying make sure that you backup your site before you do any upgrades. Take it a step further and test on a development server. That way if the site crashes you won’t lose revenue.
3 Comments
Hello James, thanks for the help! When updating magento 2.1.2 to 2.1.3 using terminal area, and putting “composer update” appears for me to enter a username and password! Is this username and password the authentication keys generated by magento?
Hello Jader,
Maybe you need to Get your authentication keys, please follow instruction in this link http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html
Hello James,
Good guideline for idea of upgrade from 2.0.x to 2.1.x. I have a plan for upgrade EE 2.0.11 to EE 2.1.x in 2018 Q1 on production platform which already running on live.
For sure we need try on testing platform with our custom modules, I suppose some conflict we need handle, Do you have idea which Magento module/functions/tables have big change I need consider in the planning stage?