Just because of the regular updates by Magento, different Magento stores become secure from the possible attacks. Every Magento update comes with new features and plenty of security updates. Hence, it is important to stay up-to-date with Magento to use its latest features to the maximum advantage and to protect your Magento stores for the potentials attacks.
Not updating your Magento web store can result in store’s low performance and it can even be easily targeted by hackers who are looking for a loophole to harm your store. Before you go for updating from Magento 2x to any of the latest versions, you must follow these basic steps for a smooth and effective update:
- There has to be the backup for both files and databases so that your data can be restored easily in case anything wrong happens while updating.
- Go through the release notes of the version to learn about the changes and features that have been introduced.
- Stay calm and composed while updating your store as it needs to be done carefully with the right commands.
- It is recommended to test the update in a staging environment just to be sure that all the aspects of your e-commerce store are compatible with the latest version.
Upgrade from Magento 2x to the latest version
You can use any of the two methods for upgrading from Magento 2x to the latest version.
Preferred Method
Log into SSH
After navigating to the public directory.
cd public_html in this case run the below. (change to latest version)
composer require magento/product-community-edition 2.2.1 –no-update
composer update
Problem Solving.
If you run into problems like this, disable or remove any extensions you have and try again. In this case we had installed the database migration tool that was specific to the version we had installed so I deleted it.
If manually removed, remove the reference from your composer.json file
Method 2: Via Connect Manager
- Open System and go to Web Setup Wizard.
- There will be requirement of public key and private key that you can get from marketplace.magento.com.
- Search for My Access key after the Log in with your Magento account credentials.
- Configure and Submit.
- On the new window, select the new version and click next.
- Go through the readiness check.
- After that, create the backup for files and database. Once you are ready with the backup, click next.
- Click on the Upgrade button to get your System Upgrade done.
- After it is done, click on Back to Setup Tool to go back to the Magento Admin.
- You will see the upgraded version and you will have to run the following commands to finish it all:
“php bin/magento setup:static-content:deploy
php bin/magento cache:clean
php bin/magento indexer:reindex”.
Method 3: Manually copy and paste the latest version to the Magento Root Directory:
- Login to your server via SSH.
- Go to Magento Root Directory.
- Take the backup of your database and files.
- Download the latest package.
- Extract it using the extract command “tar xzvf magento2-2.2.0.tar.gz”.
- Reset the file permission with the following set of commands:
“find . –type f –exec chmod 644 {} \;
find . –type d –exec chmod 755 {} \;
find ./var –type d –exec chmod 777 {} \;
find ./pub/media –type d –exec chmod 777 {} \;
find ./pub/static –type d –exec chmod 777 {} \;
chmod 777 ./app /etc
chmod 644 ./app /etc/*.xml
chmod u+x bin/magento”. - Clear cache and run upgrade, deploy commands:
“php –f bin/magento cache:clean
php –f bin/magento cache:flush
php –f bin/magento setup:upgrade
php –f bin/magento setup:static-content:deploy”.