Magento 2 update
In this tutorial I show you how to update Magento 2 to a newer version. I had to do this recently because of some needed bugfixes. Updating Magento 2 was less complicated as expected. With composer it is a quite easy task. I show you all you need to know.
Magento 2 update
First of all you need a SSH connection to your Magento shop. You need to run this update with composer, so composer should be installed on this system. We track all our projects with Git, so I did this offline on my Linux Desktop – after Update I was able to commit all changes to Git. This is not needed, but a good option, because if you detect errors or wrong behaviors you can always get back to recent version.
For an update, you need an access key from Magento. To get it, login on official Magento website with your account. On “Marketplace” tab, you will find a link to “My Access Keys”. There you can generate a new pair of private and public keys.
The whole update process is done with composer. You may install it with:
sudo apt-get install composer
If it is already installed on your system you can update you composer file with
composer require magento/product-community-edition 2.1.5 --no-update
In that case I updated a Magento 2.1.0 to current 2.1.5 version. You may need to update to a version with a far higher version number if you read this. Just change version number. Now your composer.json file is updated with this information. You no start an update with:
You now need to set you authentication. Just put your key (public for username, private for password). You can copy past from your browser.
If everything is fine, update will run automatically. You will see, that composer updates every single project (module) inside your vendor folder:
If your environment does not fit the required configuration, you will get an error message like:
Your requirements could not be resolved to an installable set of packages.
You will get detailed information on this error and which plugin is missing. For me, this were various php modules. In current case it was ext-gd, as seen in screenshot:
The solution for my error was to install php gd library on my desktop system. On my next run, composer complained about the next error. All in all I had to install the following libraries:
The reason for this was my environment. On a configured web server you may run it without error. If you do it on your machine (Linux, Windows or Mac OSX), you may need to install even more additional libraries. Be prepared to do it.
Magento 2 update is very easy. If you did no core hacks, it should work out of the box. I showed you how to run a composer update and how to fix possible errors.