How to update your Magento 2 installation

How to update your Magento 2 installation

In my previous article How To Install Magento 2, I explained how to install Magento 2, now I will explain how to update it.

Again, similarly like there are multiple ways to install it, there are multiple ways to update it. Go figure. Actually, you don’t have to go figure, just read on 🙂

The first and easiest is to update it from Magento “Web Setup Wizard”.
The second way is to update from command-line or terminal.

I will be updating from Magento 2.0.2 to Magento 2.1.0 with and without sample data, because there is a slight difference in how Magento is updated.

1. Web Setup Wizard

Updating Magento 2.0.2, without sample data to Magento 2.1.0 requires a patch! Yes, you read this correctly. You need to apply patch MDVA-532 to successfully update Magento.
Downloading patch and installing is easy. So head out to http://www.magento.com/download, download it and apply patch.

Go to:

System > Web Setup Wizard > System upgrade

system-upgrade
You will see a few steps that we must go through.

  1. Version select. I will select “Version 2.1.0 CE”, because this is the latest version of Magento, at the time of writing this article.
  2. Readiness check. If everything is green go to next step. If not, make sure you have cron jobs running, or refer to the official Magento documentation
  3. Hit “Upgrade” button!
  4. Wait untill you see this screen

installation-completed

2. Terminal

This approach also requires patch MDVA-532 so go ahead and apply it.
Then enter these commands in terminal:

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

After this is completed run:

php bin/magento setup:upgrade

to update database schema and data.

Visit the homepage to see your updated Magento 2. If you get some errors, reset file permissions and ownership and then clean cache.

3. With sample data – Terminal

If you have sample data installed, your only option to update to 2.1.0 is through terminal. Only Enterprise edition with sample data can update to 2.1.0 through Web setup wizard.

Please back up your composer.json file before continuing.

Enter the following into the terminal:

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

Now copy and paste this big chunk of command:

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
composer update

Now you wait…:)

When finished, reset file system permissions.

Then run:

php bin/magento setup:upgrade

Don’t do this immediately on live site, please test it first on dev environment.

And there you go – several ways to update your Magento 2 installation.

If you experience any problems, you should refer to http://devdocs.magento.com/guides/v2.0/release-notes/tech_bull_21-upgrade.html to get some ideas.

What’s your experience in updating Magento 2? Smooth sailing or troubled waters?

In case you feel you need some extra help, we can offer you a detailed custom report based on our technical audit – feel free to get in touch and see what we can do for you!

Related Inchoo Services

You made it all the way down here so you must have enjoyed this post! You may also like:

What’s New in Magento 2.4? Features and Benefits for Merchants Explained Antonio Gotovac
Antonio Gotovac, | 1

What’s New in Magento 2.4? Features and Benefits for Merchants Explained

Magento 2 Customer Groups Configuration Josip Kovacevic
Josip Kovacevic, | 2

Magento 2 Customer Groups Configuration

How did we standardize Magento 2 frontend development? Ljiljana Milkovic
Ljiljana Milkovic, | 8

How did we standardize Magento 2 frontend development?

9 comments

  1. I seem to be struggling. For some reason I get component conflicts in the readiness check. But I don’t know what is conflicting.
    My crons seem to pass the test.

    Is there anything else I can try? I am using CE trying to update to 2.1.7 I am using cpanel and don’t have access to the server.

    Could I be missing a cron? Below is the crons I have in place.

    /usr/bin/wget http://steelcitysports.co.uk/cron.php

    /usr/bin/php -q /home/steelcit/steelcitysports.co.uk/script.php

    /usr/local/bin/php /home/steelcit/steelcitysports.co.uk/bin/magento setup:cron:run >> /home/steelcit/steelcitysports.co.uk/var/log/setup.cron.log

    /usr/local/bin/php /home/steelcit/steelcitysports.co.uk/update/cron.php
    >> /home/steelcit/steelcitysports.co.uk/var/log/update.cron.log

    /usr/local/bin/php /home/steelcit/steelcitysports.co.uk/bin/magento cron:run | grep -v “Ran jobs by schedule” >> /home/steelcit/steelcitysports.co.uk/var/log/magento.cron.log

    /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php –backup –auto=1 –insid=72_73911

    /usr/bin/php /var/www/steelcitysports.co.uk/bin/magento cron:run | grep -v “Ran jobs by schedule” >> /var/www/steelcitysports.co.uk/var/log/magento.cron.log

    /usr/bin/php /var/www/steelcitysports.co.uk/update/cron.php >> /var/www/steelcitysports.co.uk/var/log/update.cron.log

    /usr/bin/php /var/www/steelcitysports.co.uk/bin/magento setup:cron:run >> /var/www/steelcitysports.co.uk/var/log/setup.cron.log

    I am new to Magento and crons

    Any help will be appreciated.

    1. Here is what you might do: download a fresh copy of the latest M2 and just copy it over your old files.

      Then run php bin/magento setup:upgrade

      Backup files and DB first.

      Report back how it went.

  2. Thanks for sharing. Terminal method works but it asks to re-run compile command. Is it necessary?

  3. Great tutorial, Ivan. I have one question, also. What do you think is the best solution, after a local update is done, for sending files to server? Do you think copying all files to server is the best way of upgrading M2, or you maybe have some other way of syncing files on local machine and server?
    Thanks,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.