Upgrade Magento 2 using Composer

Upgrade Magento 2 to the latest version using Composer

[aMiSTACX] Upgrading Magento to another version is not for the faint of heart. Really. One of the tricks is to forgo the GUI upgrade wizard and use CLI and Composer. See just a lot less issues, more verbose language on errors, and the ability to skip the backup phase. As we will take a manual full image before we start. In a LAMP/LEMP configuration this is ideal.

So here we go in my example I will update from 2.2.4 to 2.2.5:

cd /var/www/magento

sudo php bin/magento deploy:mode:set developer

sudo php bin/magento maintenance:enable

sudo php bin/magento cache:clean

sudo composer require <product> <version> –no-update

e.g sudo composer require magento/product-community-edition 2.2.5 --no-update

composer config --global discard-changes true

sudo composer update

Error or Prompts – at this point hopefully you will not get any errors, and if so you’ll have the ability to resolve by accepting composer’s versioning. By no means can we cover all of the potential issues here :/

If you made it past update, then it should be clear sailing.

sudo chown -R www-data:www-data /var/www/magento

sudo php bin/magento setup:upgrade

sudo chown -R www-data:www-data /var/www/magento

sudo php bin/magento setup:di:compile

sudo chown -R www-data:www-data /var/www/magento

sudo php bin/magento cache:enable

sudo php bin/magento maintenance:disable

sudo php bin/magento cache:flush

Test

sudo php bin/magento deploy:mode:set production

sudo php bin/magento setup:static-content:deploy

sudo chown -R www-data:www-data /var/www/magento

 

Should be good to go!

Better – Stronger – Faster

aMiSTACX