Magento has officially announced that they will stop Magento 1 support by June 2020. Therefore, update Magento store to higher version is important, because you should stabilize your online business activity as soon as possible. There are multiple ways to update Magento store. If you are really good at dealing with tech work, this article will guide you on how to update Magento using command-line.

1. Put your store in maintenance mode to update Magento

Before updating Magento 2 using command-line, you need to put your store in the maintenance mode and back up your data. This will prevent access to your store during the upgrade process and avoid risks in case you operate incorrectly. It also means your store will stop business activity for a while or days.

Here is the way to enable this mode:

  • Firstly, log in to your Magento server > the Magento file system owner.
  • Enter the following command:

php <your Magento install dir>/bin/magento maintenance:enable

2. Upgrade using Command line:

Step 1: Log in to your Magento server as, or switch to, the Magento file system owner.
Step 2: Change to the directory in which you installed the Magento software.

For example: cd /var/www/html/magento2

Step 3: Enter the following commands:

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

composer update

For example, to upgrade to Magento Open Source version 2.0.14, enter:

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

composer update

Step 4: Then enter your authentication keys.
  • Log in to the Magento Admin as an administrator
  • Click System > Tools > Web Setup Wizard
  • Click System Configuration
  • Enter your public and private authentication keys in the provided fields
  • Click Save Config
Step 5: Manually clear var subdirectories:

rm -rf <Magento install dir>/var/cache/*

rm -rf <Magento install dir>/var/page_cache/*

rm -rf <Magento install dir>/var/generation/*

If you use cache storage other than file system (e.g., Redis, Memcached, etc.) you need to manually clear the cache there too.

Step 6: Update the database schema and data:

bin/magento setup:upgrade

Step 7: Put your storefront online (it means to disable the maintenance mode):

php bin/magento maintenance:disable

Step 8: Restart Varnish if you use it for page caching

 

Step 9: Access your storefront.

The following error might display: We’re sorry, an error has occurred while generating this email.

Please perform the following tasks:

<your Magento install dir>/var/cache

<your Magento install dir>/var/page_cache

<your Magento install dir>/var/generation

Lastly, after the upgrade, again check your Magento version with the following command:

php bin/magento —version

Finally, if you find this update way too complicated and potential of risk, you can use LitExtension Migration App to do it. LitExtension is designed for all users and requires no technical and programming skills. You also can follow How to upgrade Magento 2 with LitExtension here.

Author

Since 2011, I founded LitExtension Solutions offering shopping cart migration service including Magento, WooCommerce, Shopify,... LitExtension has been the leading provider of automated Shopping Cart Migration Service in the world with more than 20,000 global customers and we have delivered 30,000+ successful migrations to our customers over the past 5 years.