How to upgrade Magento 2.x via CLI

We can upgrade Magento 2.x via Command-Line Interface (CLI), but I have to remind again that you should backup all your website files before go ahead.

Upgrade Magento 2.x by command

Please back up your composer.json file before continuing.

The followed command will upgrade composer.json file:

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

Note: As 2.1.2 means the latest Magento version, so the numbers can be changed accordingly.

The followed command could upgrade the files:

composer update

Note: It will ask for repo.magento.com authentication keys. For more information, visit this link.

Then execute the followed commands one by one:

rm -rf var/di var/generation

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento cache:clean

php bin/magento cache:flush

php bin/magento indexer:reindex
1 Likes
148 Views

You may also like

Leave A Comment

Please enter your name. Please enter an valid email address. Please enter message.