MagentoMagento 2

How to Upgrade Magento 2 with SSH

After creating our video about upgrading Magento 2 via the web wizard we received numerous requests to provide instructions on how to upgrade with SSH as well.

First, create a backup. This can be done either with Magento 2 commands via SSH, through the Magento 2 Administrative Backup Wizard, or manually using either your hosting providers control panel or directly through SSH.

Now that your system is backed-up it’s time to upgrade! Open a connection to your server via SSH and navigate to the root of your Magento 2 installation then run the following commands.

Put the store in maintenance mode

bin/magento maintenance:enable

Use composer to retrieve the desired Magento 2 release. In this example we are upgrading to version 2.2.2 this can be changed to any version beyond the one currently installed simply by adjusting the version prior to the –no-update command.

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

Use composer to retrieve the required dependencies for the Magento 2 update.

composer update

Delete all caching and pre-generated content from the previous store version.

rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf var/generation/*

Make bin/magento executable.

chmod +x bin/magento

Run the Magento 2 update script.

bin/magento setup:upgrade

Take Magento 2 out of maintenance mode.

bin/magento maintenance:disable

Your Magento 2 store has now been updated.

 

The full series of commands in order are listed below.

bin/magento maintenance:enable
composer require magento/product-community-edition 2.2.2 --no-update
composer update
rm -rf var/cache/*
rm -rf var/page_cache/*
rm -rf var/generation/*
chmod +x bin/magento
bin/magento setup:upgrade
bin/magento maintenance:disable

 

Hans-Eirik Hanifl

Hans-Eirik Hanifl is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

Related Articles

Leave a Reply

Back to top button
Sign up to the E-Commerce Gorilla newsletter for updates & special promotions.
Join Our Newsletter
SUBSCRIBE
We value your privacy and protect your information like our own. Unsubscribe at anytime.