How to Upgrade Magento 2 Website to Latest Version

Home >> Blog >> Magento 2 >> How to Upgrade Magento 2 Website to Latest Version
How to Upgrade Magento 2 Website to Latest Version

Magento 2 is the next generation eCommerce platform with lots of benefits over the older version Magento 1

Since you are already running your web shop on Magento 2, it is important that you keep it secure and up to date by upgrading your Mageno 2 set up to the latest stable version

And to make it easy for you, Our Magento 2 experts have prepared this guide to update your magento 2 installation to latest version

Backup

Before you start working on the version update, first thing you want to do is take full backup of your Magento store. Take backup of store files and database using your server’s control panel or SSH otherwise consult your hosting provider for the help. You can restore your web shop using the backup if any of the steps break your website or causes data loss

Disable Cache

Make sure that Magento cache is disabled during the version update process. This will save you a lot of time

To disable cache go to Admin → System → Cache Management → select all cache types and disable them

Pre-update Checklist

We recommend you to follow below checklist before doing the version update to make this process hassle free and less stressful

  • Check for the available versions of Magento 2 and choose the most secure, recent and stable version to update your installation
  • Once you have identified the version, Carefully read the notes to get familiarized about the changes made on that version
  • Make note of any customizations or overrides you may have done on your web shop for you to check and ensure all the functionality is working as expected for your store after the upgrade is done
  • Create a staging website or environment where you can first try the update and check compatibility of your server as well because there might be some changes needed in server configurations for new version
  • Keep note of all the logs, messages and reports which are shown during the version update so you can keep track of any modifications you may have done during that step to install other libraries or updates on server or modules
  • Last thing is to decide on the time to do the version update on live website by following all the steps again. After the version is updated on the staging site successfully and you have ensured everything is working as expected without any issues or conflicts then schedule the update on the live web shop when there is no traffic on your website

Now that we have prepared for the version update, follow the instructions below

There are 2 ways to upgrade Magento 2 version

    1. Web Setup Wizard
    2. Composer via Command Line

1. Web Setup Wizard

  • Before updating your Magento 2 store with this option, make sure you have a Magento account and have keypair generated in your account
  • Here’s how you can set the keypair. Go to Admin → System → Web Setup Wizard→System Config and add the public and private key there and click Submit
  • magento2-system-upgrade-system-config

  • Now go to Admin → System → Web Setup Wizard→ System Upgrade. Select the latest and stable Magento 2 version here and keep Other Components set to No because updating them with Magento may cause issues
  • magento-system-upgrade

  • Next you will start the ‘Readiness check’. If your system and server is compatible with the selected version of Magento 2 then you are all good to go otherwise you have to resolve the issues first which are presented there before moving to next step. Make sure you have cron jobs running or refer to the official Magento Documentation for server compatibility check
  • Click Next once Readiness Check is passed and Create a backup by checking all the boxes (Code, Media, Database) and click Create backup. This may take quite some time based on the size of your store and database files
  • Once the database backup is created, click Upgrade to finish the version upgrade
  • If your Magento is updated to latest version then you will see below screen with confirmation for successful version update
  • magento2 installation completed

  • After you have updated your Magento 2 store version, it is recommended to remove the setup files because they are publicly accessible and causes security breach. Remove this directory from your hosting account or FTP or SSH /data/web/magento2/setup. If you face any difficulty during the process, Contact your Magento 2 development company to assist

2. Composer via Command Line

You can also do Magento 2 version update using Composer from Command Line in case the Web Setup Wizard does not let you do the update due to any conflicts, extensions or readiness check required

  • For this you will need SSH access of your server to execute commands via command line. But make sure you are not logged in as a root user but normal user or apache user or whichever user is shown as the owner of the Magento directory otherwise it will cause conflicts
  • Login with SSH details on the server and go to your Magento root directory and run below command where {version} is the latest version which you want to update to for example, 2.2.5:
  • This will specify in composer.json which version you want to update and after that you have to run this command to start the version update process:
  • Once above command is successfully completed then you are almost ready to get the new version running. Now that everything is installed or updated then let’s clear the old codepool and cache with below commands one by one:
  • Now its time to update the database schema and data as per the new version updates with below command:
  • Next we need to run below command to run the compiler which will do compilation of the code and generate codepool, repositories, service data attribution and validate dependencies:
  • And after that you have to run another command to deploy the theme files:
  • And at last to reindex the data in database we need to runthe command:
  • Now we are all done with upgrading Magento 2 to the latest version and it’s time to check what is the current Magento 2 version with below command:

Before you sign off, make sure the directory permissions are correct and enable the cache.
To enable cache go to Admin → System → Cache Management → select all cache types and enable them

If you have any other questions about upgrading your Magento 2 set up to the latest version, Please feel free to write in the comments section below and our Magento 2 migration service team would be happy to help

Share
Leave a Reply