Tutorial: How to Upgrade Your Magento 2 Version
Today we look at how to upgrade your Magento 2 version. The process is very simple if you have good technical skills.
First of all, if we are upgrading a production site (avoid experimenting like this like the plague), it is essential to enable maintenance mode with the following shell command, in the project root:
php bin/magento maintenance:enableAt this point the site will be in maintenance mode and users will no longer be able to continue shopping, which lets us work calmly on the platform without causing problems for anyone.
Now we can start working with composer. First, again from the shell, let’s make sure we don’t have a composer.lock file, which would prevent us from proceeding with the install. So let’s remove it:
rm composer.lockLet’s proceed with updating the composer file. In this case I need to upgrade my version to 2.3.4, and we are talking about the Community edition:
composer require magento/product-community-edition=2.3.4 --no-updateIf I wanted to upgrade the Magento Commerce edition (better known as Enterprise to those coming from Magento 1), the command would be the following:
composer require magento/product-enterprise-edition=2.3.4 --no-updateWe have now updated our composer file, and with the following command we will upgrade our platform:
composer installOnce the installation is finished, we need to run the command to complete the procedure:
php bin/magento setup:upgradeIf you are not in developer mode but in production mode, the commands to complete the procedure are the following.
To compile the project:
php bin/magento setup:static-content:deployTo disable maintenance mode:
php bin/magento maintenance:disableAt the following link you can find the official procedure:
https://devdocs.magento.com/guides/v2.3/comp-mgr/cli/cli-upgrade.html
P.S. To see all the available versions of Magento 2:
composer show magento/product-community-edition 2.3.* --all | grep -m 1 versions
composer show magento/product-enterprise-edition 2.3.* --all | grep -m 1 versions