Pre Black Friday Sale. 20% OFF on all products. Coupon code: fme20off

3 Easy Ways to Upgrade Magento 2 to the Latest Version

It is hard to imagine stores still running on Magento 1 as it reached its end of life in June 2020. However, if your store is still running on the outdated version, migrate from Magento 1 to Magento 2 right away. If you are already on Magento 2, you need to ensure that you are running the latest version. Upgrading your Magento 2 store to the latest version will equip it with the newest features and improved security.

It is important that you keep your store updated as otherwise; it will not only miss important features but will be an easy target for hackers. In this article, we will cover all the 3 methods to upgrade your Magento 2 store. Before we do that, let’s see some pre-upgrade tasks. These tasks will ensure that the upgrade process goes smoothly and if in case something goes wrong, you have a way to recover it.

Magento 2 Update Prerequisites

Before trying to upgrade your Magento 2 store to the latest version, you need to perform a few tasks:

Enable Maintenance Mode

The first step you need to do is enable the maintenance mode. While it is not mandatory, it is highly recommended. The alternative is to start the upgrade the process when the store has minimal traffic. To enable the maintenance mode, go to the server’s command line interface and type:

 
php bin/magento maintenance:enable
To disable the maintenance mode, type:
 
php bin/magento maintenance:disable

If you are unsure whether the maintenance mode is enabled or disabled, simply enter the following command:

php bin/magento maintenance:status

For enhanced user experience, we recommend personalising the maintenance page according to your brand. You can easily edit the default page by making changes to the errors/default/503.phtml file.

Take a Backup

After enabling the maintenance mode, you need to take a backup of your Magento 2 store. You need to understand that there are different types of backups:

  • One is referred to as the ‘System Backup’, also referred to as a full or complete backup. This saves every available information, including the Magento 2 file system, media folder, and the database.
  • The second type is the ‘Media and Database Backup’. As the name indicates, it only takes a backup of the media file and the database.
  • The third type is called ‘Database Backup’ and it only takes the database’s backup.

The easiest way to take a backup is through the Magento 2 admin panel. All you need to do is login to the Admin Panel -> System -> Backups. Now, select the backup type and start the process. To restore a backup, you need to go the same interface. An alternative method to take a backup is by running this command:

bin/magento setup:backup --code --media --db

This will back up the System Code, Media Files and Database. If something goes wrong and does not let you proceed further, you can revert to the old version.

3 Ways to Upgrade Your Magento 2 to the Latest Version

Following are the 3 ways using which you can upgrade Magento

  • Using Web Setup Wizard
  • Using Composer
  • Uploading the Latest Version Manually

Method 1: Update Magento 2 to the Latest Version Using Web Setup Wizard

If you are opting for this option, make sure you have a Magento account, and your Public & Private Keys generated. The way you find these keys is by logging into your Magento Account and going to Marketplace. Click on My Access Keys. Remember, you must use the same authentication keys you used to install the Magento software.

  • Login to Magento backend as user with full permission.
  • Navigate to System -> Tools -> Web Setup Wizard
upgrade-magento-2-version
  • Click System Upgrade
  • Enter your Public & Private Keys
  • Click Submit
upgrade-magento-2-version

It will now check for all new versions on your store.

Now you are on the system upgrade. The first thing you want to do is select the latest Magento 2 version from the Magento Core Components dropdown. You can also upgrade other components at the same time. Recommended is to keep it to No.

upgarde-latest-version-magento-2

Click Next to go to the Readiness Check which will check your PHP versions, extensions, file permissions, etc.

If you get errors in the Readiness Check, you can upgrade your PHP version , check for 2.3.x System requirements or setup the cron job depending upon the error message. Once everything is ok, click Next to move over to Create Backup. Before you click on Create Backup, make sure you have sufficient storage on your server.

Upon successful upgrade, you will see the following screen.

upgarde-magento-2-version

Method 2: Upgrade Using Magento Composer

The second way to do Magento upgrade is to use composer via command line. For this, you need SSH access to connect to your web server and execute commands. Following is the workaround.

  • Login to your Magento 2 web server using SSH details.
  • Now run the following command to upgrade to the latest version
  • Navigate to your Magento 2 root directory i.e. cd ~ /public_html.

composer require magento/product-community-edition {version} –-no-update"

where {version} is the latest Magento version you want to upgrade to.

Now run the following command to start the update process.

composer update

Successful completion of the above command will upgrade your Magento version and you are ready to start running the new version. Running the following commands will clear the old cache.

rm-rf var/di var/generation
php bin/magento cache:clean
php bin/magento cache:flush

The following commands will update the database schema, run the compiler, deploy static content, and reindex the data respectively.

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex

That’s all you need to do to upgrade your Magento 2 version using composer. If you want to check the version you have just upgraded to, the following command will do this. You can also check it at the bottom right corner of your Magento 2 Admin panel.

php bin/magento --version

Method 3: Upload the Latest Version Manually

This method is the simplest of all the three methods and suits inexperienced Magento users. Download the latest/required version from the official Magento website . Unzip the downloaded file in the Magento 2 root folder. This will override the old files with the new ones. Now, simply run the following commands in SSH console one by one to upgrade, update database schema, and flush cache.

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento cache:clean
php bin/magento indexer:reindex

Final Thoughts on Magento 2 Upgrade

As you see, there is more than one way to upgrade your Magento 2 to the latest version. It’s all about your choice to opt for a particular method. For example, the setup wizard method is easier and good for people who are not comfortable with command line. Should you have any questions or run into any errors? Do contact our Magento 2 upgrade team. Want to switch to Magento 2, we also offer Magento 2 migration service .

This blog was created with FME's SEO-friendly blog