You can upgrade or update your current Magento version to a specific higher version using composer and command line.
You can even simplify your upgrade through professional Magento 2 upgrade services.
For that, you have to open terminal/command prompt.
After that go to you’re Magento site’s root directory in the terminal using cd command
For example, your Magento site can be in folder/directory path as /var/www/html.
So go to that directory from command line and after that, check your current Magento version with the following command.
php bin/magento --version
Running the above command will output something like this:
Magento CLI version 2.1.7
The above output shows that your current Magento version is 2.1.7.
Now if, you want to upgrade your Magento site to version 2.1.8.
For that, you have to run the following commands:
Note that, you have to be in your Magento’s directory root while running the below commands.
Step 1 -> Put your site into maintenance mode.
php bin/magento maintenance:enable
Step 2 -> Install the Composer update plugin
composer require magento/composer-root-update-plugin ~2.0 --no-update
(Run this command, if you are using PHP 7.3 or above)
composer require magento/composer-root-update-plugin ~1.0 --no-update
(Run this command, if you are using PHP 7.2 or lower)
Step 3 -> Take a backup of the composer.json
cp composer.json composer.json.bak
Step 4 -> Update Magento version in composer.json file using below command. You can type the any required Magento version.
composer require-commerce magento/product-community-edition <Magento version> --no-update
(example: composer require-commerce magento/product-community-edition 2.1.8 –no-update )
Step 5 -> Update dependencies using the following command.
composer update
Step 6 -> Execute the following commands.
rm -rf var/di var/generation php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento: setup:static-content:deploy php bin/magento indexer:reindex php bin/magento cache:flush
Step 7 -> Disable the maintenance mode
php bin/magento maintenance:disable
After the upgrade, again check your Magento version with the following command:
php bin/magento --version
Output showing :
Magento CLI version 2.1.8
Be the first to comment.