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

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.

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

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

Make bin/magento executable.

Run the Magento 2 update script.

Take Magento 2 out of maintenance mode.

Your Magento 2 store has now been updated.


The full series of commands in order are listed below.


Hans-Eirik Hanifl

view all posts

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.

0 Comments Join the Conversation →

Leave a Reply

Stay in the loop!

E-Commerce Gorilla Avatar

Join the E-Commerce Gorilla e-mail newsletter. We provide monthly updates on new articles featuring all aspects of online sales and E-Commerce setup. We cover the do's and don'ts of effective online sales, along with great giveaways. As a newsletter subscriber you are automatically entered for any competitions and giveaways.* Join our community of engaged online marketing experts, great content, and great giveaways. You can't go wrong.