My Cart
Filters
book-2265490_640

Magento 2 Update and Upgrade Tutorial

Previously we’ve already touched the point related to upgrading from Magento 1 to Magento 2.

Magento 2 Update and Upgrade Tutorial

Although, this issue is still in great demand among Magento users the number of existing Magento 2 versions and stores makes it necessary to pay attention to the new question of updating existing Magento 2 stores to the latest available versions.

And since recently we witnessed the next Magento 2.2, the topic is going to become in high demand just soon. One more reason for an upgrade may appear when you need to enhance your store with the facilities of Magento 2 Commerce and need to migrate your Magento Open Source store to it. Thus, we have two general points to be discussed in this article: Magento 2 update and Magento 2 upgrade.

Magento 2 Update


The whole process consists of several separate stages and affects several Magento 2 entities. First of all, you need to update the very Magento application, while additionally, it may also require updating the included modules (e.g. third-party functionality extensions), themes, and language packs, if necessary.



Depending on the way of initial installation, you can update the Magento application in two ways. Both the editions (Magento Open Source and Magento Commerce) can be updated via the provided Setup Wizard or the command line in the case they were initially installed as Composer packs or downloaded as archives. The developers that contribute to the Magento 2 GitHub repository can clone it manually.

Prerequisites


Before updating or upgrading a Magento store you need to consider the whole scope of future work, e.g. the version you are going to update to, the modules you need to transit to the updated store, and the prerequisites required by the platform for this process.

The preliminary actions embrace the following tasks:

  • System recourses improvements;

  • Cron setup;

  • Other prerequisites.


Ulimit Configuration
The Ulimit command allows you to prescribe the necessary amount of system-wide resources used by the shell environment in use. The Magento team offers to set up it as 65536 and higher. This action (and some other improvements) provides you with the confidence that the rollbacks, you will probably need, are not going to result in incomplete data written to the file system or database.

Cron Setup
Any update or upgrade process engages two cron jobs to be run every minute. The tasks scheduled by cron are used by Setup Wizard and the updater application. The latest version of Magento creates crontabs to any applications or extensions previously scheduled by cron .

For more information on how to create and delete crontabs and run cron in Magento please refer to the official Magento documentation.

Other Prerequisites
DATA_CONVERTER_BATCH_SIZE Environment Variable Enhancement. As soon as the destination versions of Magento may include security packs containing some data to be converted into the JSON encoded format, the whole process of conversion may take quite a long time. In this light, Magento offers you to increase the variable value, which is set to 50.000 by default. For example, you can set it as 100.000 or more.

Magento File System Owner and Group. The Magento File System owner is the user who owns files in the Magento system. It is obligatory that during the update or upgrade process the user has the write access to Magento directories and files.

File Permissions. For successful updates and upgrades, system files need to be writable by the Magento file system owner’s group.

Magento Module and Extension Managers


In order to install, update or uninstall Magento functionality extensions and other custom code you can take advantage of Magento Wizard with necessary Module and Extension Managers. The topic has been discussed in our blog just recently.

Command Line Update


In order to update your Magento using the command line and prevent any unauthorized access to it please put your store in the maintenance mode. During this period you can take advantage of the custom maintenance page.

The process includes several server installation commands, alterable according to the target Magento versions, cache clearance commands, database updates, and the commands disabling the maintenance mode and restarting Varnish.

The process of upgrading to Magento 2.1 with sample data is a bit different and described individually.

System Update


The same as in the previous paragraph, the store running the update process is only partially available for customers. For example, they can browse catalogs, but cannot purchase products. So, perhaps it’s better to display a custom maintenance page for them in this case. And, do not forget about the required prerequisites.

In order to start the process, enter the System Configuration section at System -> Tools -> Web Setup Wizard. Enter the authentication keys in the provided fields, if necessary, and save the configuration.

Note: You have to use the authentication keys used during the installation process.

Magento 2 Setup Wizard

Magento 2 Setup Wizard


Start the system update selecting the target version of Magento and other components to be installed additionally.

The second step is to check the readiness of the system for the update. At this stage, quite different errors may appear. So here is the list of actions for troubleshooting several of them.

Next, comes the backup step, just like above for the command line update process. The interface offers you to backup system files, the pub/media directory, and database. You can check one or several options, all of them or skip the step by unchecking all the provided boxes. As soon as the successful backup is confirmed, you can proceed to the final step of the update process.

In the fourth step, you need to click the Upgrade button and complete the process. As soon as the Success indicator is displayed you can return to the Setup Tool.

At the end of the process, you need to manually clear var directories, restart Varnish, and remove some possible errors on the frontend.

That’s all, the process is completed.

Magento Open Source to Magento Commerce Migration


The process of upgrading to Magento Commerce from Magento Open Source made by Setup Wizard almost entirely duplicates the one described above. The only difference is that you need to additionally install the PHP bcmath extension required for Magento Commerce.

As far as Magento Commerce is the paid edition of Magento, in order to get access to its versions via the Web Setup Wizard you also need to contact the Magento Support team.

All the other steps are the same.

Troubleshooting


Despite the number of required actions is limited, the update/upgrade procedure may cause several known issues and the Magento team described most of them quite thoroughly. For example, you might need to update the updater application, or face memory, cron, PHP version, component dependency, etc. errors. All the detailed descriptions of those errors and troubleshooting actions are provided by Magento DevDocs.

For more information about Magento installation, configuration, updates, etc. read our official blog.