Upgrading your Magento 2 store is the first thing you should do to take advantage of the new features. While there are 3 ways to upgrade Magento 2, we will only focus on one particular method in this article, that is, to upgrade via CLI (command line interface). You can use this method if you have installed the Magento software by
To make sure the process goes smoothly, do the following before you start the upgrade.
bin/magento maintenance:enable
Follow the steps below to upgrade your Magento 2 via CLI.
Step 1: Access Your Magento Server Via SSH
You need to login to your Magento server using your SSH credentials.
Step 2: Navigate to Magento 2 Root Directory
Once you are connected, navigate to your Magento 2 root directory. Usually, it is public_html.
Step 3: Apply Upgrade Commands
Apply the following commands to upgrade.
composer require magento/product-community-edition=2.3.3 --no-update composer update
version 2.3.3 is the latest version. You can change this number accordingly.
Step 4: Enter your Authentication Keys
It will ask for authentication keys. If you don’t know how to find/generate authentication keys, click here.
Step 5: Manually Clear Cashes and Generated Content.
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/*
Step 6: Update the Database Schema & Data
php bin/magento setup:upgrade
Step 7: Disable Maintenance Mode
You are ready to make your store live again.
php bin/magento maintenance:disable
That’s all you needed to do. Now, open your storefront URL in a web browser and see if the upgrade was successful.