Magento is one of the best open source e-commerce platforms that helps business owners or individuals to build an e-commerce website.
There are several reasons to update, including the fact that the new version will make your work simpler, faster, more efficient and more secure.
This article is about how to update Magento 2 in three easy ways, but make sure to backup your data before performing the update. You can hire a Magento 2 developer to accomplish the update process.
- Update Magento using composer
- Update using setup wizard in Magento admin page
- Upgrade manually
1. UPDATE USING COMPOSER
- Log in and head to root folder cd ~ /public_html and switch to the maintenance mode.
- Use command php bin/Magento maintenance: enable to enable maintenance mode and remove everything from the vendor folder using command rm -rf vendor/*
- Now open the composer.json file and replace the current version with the latest version.
- After this, use the command Composer update and then you will have to provide access key that you can get from here after logging in to your account.
- Enter public key (username) and private key (password), and the installation will start soon.
- After installation, clear var child directories via using the below commands:
rm -rf <Magento install dir>/var/cache/*
rm -rf <Magento install dir>/var/page_cache/*
rm -rf <Magento install dir>/var/generation/*
You need to use a query to upgrade the database schema php bin/magento setup: upgrade.
Finally, disable the maintenance mode by using command php bin/magento maintenance: disable
2. UPDATE USING SETUP WIZARD IN ADMIN PAGE
Here is the second method. If you are not able to update Magento using composer then, you can update using the admin menu in the setup wizard.
This method is only for who have full access to the admin menu.
Step 1: Head to System > Tools and then web setup wizard.
Step 2: Now click on system configuration and provide required keys if it asks, and then save config.
Step 3: Again click on system upgrade and the process will start soon. During the readiness check, you might get some PHP- or plugin-related errors.
Step 4: In the next page skip backup or do a manual backup because update process may fail. So, it’s better to create a backup manually and skip this step to complete update.
This is the second method you can use to update Magento easily.
3. MANUAL UPDATE
If you are facing a problem with the above methods, try this last one out. It’s easier to understand and implement.
First of all, you need to download the latest version of Magento 2 in zip format.
Note: Click here to download the zip.
Then unzip this file to the root folder. This will replace existing files with new files. After this, write the following commands in SSH console:
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:clean
php bin/magento indexer:reindex
Now, you have successfully updated Magento 2 using this method.
In this article, we have mentioned three methods to update Magento 2. Use any of these methods which is easier for you. It is recommended to perform an update whenever new version releases because every new update comes with the new feature, improved layout, and other fixes. There is a service called Magento 2 migration services which you can use to enhance the speed and performance of your store.