How to Upgrade to Magento 2: Step-by-Step Instructions

Table of Content

how-to-upgrade-magento
Posted in: Magento 2 Guides

If you're a Magento store owner, you already know that staying up-to-date with the latest technology is crucial for ensuring your online business thrives. As Magento constantly continues to grow and innovate, upgrading to the latest version can help you unlock a world of new possibilities.

In this article, we describe the key 3 methods of upgrading Magento, each tailored to suit the unique needs of different store sizes and complexities.

Why Upgrade to Magento 2

Before we dive in, let's understand why you should upgrade your Magento store to version 2 or later. Here's what benefits you're in for:

  • Improved Performance and Scalability – Magento 2 uses the latest technologies and code optimizations, offering faster page load times and better overall performance.
  • Enhanced Security – Get improved security features and updates that are essential in protecting your online store and customer data.
  • Mobile-Friendly and Responsive Design – The new version comes with a responsive design out of the box, which is crucial as mobile shopping continues to rise in popularity.
  • Streamlined Checkout Process – Embrace a more user-friendly and streamlined checkout process that will help you reduce cart abandonment rates and improve the shopping experience for customers.
  • Admin Interface Improvements – The admin panel has been revamped and made more intuitive, making it easier to manage products, orders, and customer data.
  • SEO-friendly Features – Magento 2 includes built-in SEO features and supports modern SEO practices, helping your store rank better in search engines and improve online visibility.
  • Integration Capabilities – Magento 2 offers better integration possibilities with third-party tools, payment gateways, and shipping providers.

How to Upgrade Magento

Of course, the safest way to upgrade Magento is to request professional Magento upgrade services. Seasoned Magento developers will perform all the necessary tasks, guaranteeing quick results with no data errors or damage. At Amasty, we also strive to perfrom Magento upgrade with minimum downtime, allowing you to keep doing business as usual. 

Still, if you're tech-savvy enough, you can try to perform the migration yourself by following one of the 3 key upgrade methods we describe below.

Pro tip from Amasty: Before you start following any of the upgrade guides, remember to back up all your files!

Done? Great! Now, on to the methods.

METHOD #1. UPGRADE VIA MAGENTO 2 COMPOSER

The first method is based on using Magento 2 Composer for upgrade and includes the following 8 steps.

Step 1. Logged in as a system owner (root user), navigate to the Magento 2 root folder cd ~ /public_html

Step 2. Switch to the Maintenance mode via the command php bin/magento maintenance:enable

Step 3. Clear everything in the vendor folder by running the command rm -rf vendor/*

Step 4. Open the composer.json file and change the current version of your Magento to the required one, as in the screenshot below:

Check Magento 2 version in the json file.

Alternatively, you can execute the Require command to request the Magento 2 package to use Composer and update associated files:

composer require <product> <version> —no-update

composer update

Say, you would like to upgrade to Magento 2 CE 2.4.5. Then use the command as in the example:

composer require magento/product-community-edition 2.4.5 —no-update

composer update

Pro tip from Amasty: You can use Composer to upgrade Magento to any version you need, for example, perform a Magento upgrade from 2.4.4 to 2.4.5.

Step 5. Specify access keys if needed. You can get them using the following link. This is what you will see after you log in:

magento 2 access keys

Username corresponds to the public key and password corresponds to the private key.

After you enter keys, the installation of files will begin automatically.

Step 6. When the installation is complete, you need to clear var child directories. To do this, execute the commands below:

rm -rf <Magento install dir>/var/cache/*

rm -rf <Magento install dir>/var/page_cache/*

rm -rf <Magento install dir>/var/generation/*

Pro tip from Amasty:  If you use Varnish, Redis, Memcache, or another caching option, remember to flush them.

Step 7. After clearing subdirectories, use another query to upgrade the database schema:

php bin/magento setup:upgrade

Step 8. Disable the Maintenance mode and put your store back to work by running the command:

php bin/magento maintenance:disable

METHOD #2. UPGRADE VIA MAGENTO 2 SETUP WIZARD

For those new to Magento upgrade, Magento 2 Composer can be tough to handle. This second method we offer is a lot easier and more automated.

Magento provides a built-in web-based setup wizard that allows you to perform upgrades directly from the admin panel. This method is suitable for you if you have a relatively small store with simple setups and minimal customizations.

Step 1. Access your store admin side as a user with full permissions (super-admin).

Step 2. Navigate to System > Tools > Web Setup Wizard. You will see the following menu:

Access the Magento 2 setup wizard.

Step 3. Select the System Configuration option.

You may be asked to specify authentication keys in the corresponding fields. Again, you can get the keys on Magento Marketplace (see the link above).

Step 4. Click Save config and then System Upgrades.

Pro tip from Amasty:  Back up files manually and skip the backup step suggested by the wizard. Wizard's backup often fails midway and you'll have to restart.

During the upgrade process, you will get detailed instructions so there shouldn't be any issues. Note that, at the Readiness check process step, you may be asked to upgrade PHP since M2.3, and M2.4 support different PHP versions.

  • To learn more about PHP support, check system requirements for M2.3, M2.4.

METHOD #3. UPGRADE TO THE LATEST VERSION MANUALLY

This method seems simple but is more time-consuming and error-prone. For stores with many customizations or extensions, the risks of data conflicts and damage are especially high. We advise using this option only if your store has very minimal customizations.  

Step 1. First, go to the official Magento website to download the required version. Put the downloaded files to the Magento 2 root folder and unzip the package.

Step 2. If Magento asks to replace existing files, click ‘Yes’.

Then, in SSH console, run the following commands one by one.

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

php bin/magento cache:clean

php bin/magento indexer:reindex

Pro tip from Amasty:  Make sure every command is complete before starting the next one.

All the listed php bin magento upgrade commands will help you refresh the database schema, update all dependencies, and flush caches. If you have a lot of products, customers, orders, etc., you may need to wait some time until each command is executed.

Step 3. Once you're done, check your store frontend and admin view to ensure that everything looks and works as expected. If you use third-party extensions, run some smoke tests to check that these modules are still compatible with your new Magento version and upgrade them as well if needed.

WRAPPING UP

Now that you know how to upgrade a Magento 2 store to a later version via Magento Composer, Setup Wizard, and manual effort, it's up to you to choose the most fitting option. Make sure to realistically assess your technical prowess and always feel free to reach out to Amasty's team for tips, guidance or hands-on help.

July 4, 2018
July 9, 2018
June 26, 2018
Comments
Syed Muneeb Ul Hasan
July 16, 2018
I think users normally use method 1 "Command", even me :) Thanks for sharing this great tutorial.
Reply
Alina Bragina
July 19, 2018
Hi there, thanks for taking the time to leave your feedback! We are glad to share our experience and be helpful. Cheers!
Guest
September 10, 2019
5
Reply
Peter miller
December 16, 2019
Hi, Thank you for writing such an informative blog. I’m planning to upgrade to Magento 2 and this blog has taken away all my confusions and worries regarding the migration process. I had no idea there are several ways to so.
Reply
Polina Litreyeva
December 20, 2019
Hello! Thanks for sharing your opinion. If you need help, feel free to <a href="https://amasty.com/contacts/">contact us</a>.
Yogesh
March 6, 2020
Hi Team, I'm trying to update magento 2.2.1 to 2.2.11 with METHOD #3. UPLOAD THE LATEST VERSION MANUALLY but unfortunately, the result is nothing.
Reply
Polina Litreyeva
March 9, 2020
Hello, Yogesh! Thanks for the feedback! Pity, you have the issue. You can try to update your system with the first 2 methods, or check the <a href="https://devdocs.magento.com/guides/v2.3/comp-mgr/upgrader/upgrade-checklist.html" rel="nofollow">official Magento documentation</a> for more info. Unfortunately, we need to dive deeper into the system itself to understand why an error occurred. Sorry, but that is why we won’t help you in the comments. Cheers!
Yogesh
March 10, 2020
Hello, Polina Thank you for your update I have tried with the first method i.e METHOD #1. USE MAGENTO COMPOSER everything is working fine and version also updated but please check the below points why I'm getting while using COMPOSER UPDATE command Package zendframework/zend-text is abandoned, you should avoid using it. Use laminas/laminas-text instead. Package zendframework/zend-uri is abandoned, you should avoid using it. Use laminas/laminas-uri instead. Package zendframework/zend-validator is abandoned, you should avoid using it. Use laminas/laminas-validator instead. Package zendframework/zend-view is abandoned, you should avoid using it. Use laminas/laminas-view instead.
Polina Litreyeva
March 13, 2020
Hi, Yogesh! Laminas is a new name of the Zend Framework. It seems like you got these notifications because you need to migrate to Laminas-branded packages. For more info, please check the<a href="https://www.zend.com/blog/evolution-zend-framework-laminas-project" rel="nofollow"> official Zend Framework explanation</a>. Cheers!
Me
February 15, 2021
Hi, I have read your guide: https://amasty.com/blog/3-ways-to-upgrade-your-magento-2/ Why do I need to do this command at step 3? rm -rf vendor/* In the vendor directory there are all kinds of extensions which would be removed. I can not see anywhere in your guide that these are being reinstalled. When doing the upgrade via download/copy/paste the vendor files get untouched which would make more sense to me.
Reply
Vladimir Derachits
February 22, 2021
Hi there, thanks for the feedback. You see it’s difficult to answer from here. Please, check out the <a href="https://devdocs.magento.com/guides/v2.4/install-gde/composer.html" rel="nofollow">official magento installation guide</a> to get more deatials about the installation process.
Steve ways
June 25, 2021
Magento is one of the best E-commerce platforms built on open-source technology. Thanks for sharing the informative article.
Reply
Vladimir Derachits
July 6, 2021
Hi Steve, thanks for your feedback! We are glad to share our experience and be helpful.
Leave your comment

Your email address will not be published

This blog was created with Amasty Blog Pro

This blog was created with Amasty Blog Pro

© 2009-2024 Amasty. All Rights Reserved.