How to Update Magento 2

This post describes how to update Magento 2 to the latest available version. Below, you will find all the necessary information related to the procedure, including some vital prerequisites. So, the version of your platform is a little bit outdated? Find out how to update it with the following Magento 2 tutorial.
Everything about Magento 2 on Firebear
UPD (07.04.16): Command Line Update
 
                
			
			
Table of contents
Prerequisites
First of all, you should peform Magento 2 download and installation. Then, it is necessary to log in as a Magento server user with permissions to write to the Magento 2 file system. You can choose a web server user, for instance.
Another important preparation is the ability to run Magento commands from any directory. Therefore, add <your Magento install dir>/bin to your system PATH. Check for more information. In case of CentOS, bash shell example has the following look: export PATH=$PATH://var/www/html/magento2/bin.
Note that you have alternate ways for running commands:
For
| 1 | cd <your Magento install dir>/bin | 
run them as
| 1 | ./magento <command name> | 
Or use the following one:
| 1 | php <your Magento install dir>/bin/magento <command name> | 
In both cases, <your Magento install dir> is a subdirectory of the web server’s .
You may be also interested in !
How to Update Magento 2
This part of the Magento 2 tutorial describes how to update the software without reinstalling it. Being crucial for getting all the latest code changes, the procedure requires doing everything in an development environment.
1. Now, when you are logged as a user with permissions to modify files in the file system of Magento 2, save all changes to composer.json since the following actions will overwrite it:
| 1 2 | cd <your Magento install dir> cp composer.json composer.json.old | 
2. Use the following command, in case when the optional sample data has been installed:
| 1 | rm -rf dev/tools/Magento/Tools/SampleData/ | 
3. Now, it’s time to get the latest code by updating your local repository:
| 1 | git pull origin master | 
Magento 2 GitHub repository have two major branches: master & develop. Master offers the latest stable version of code, while develop can have some new features and fixes which are not yet ready for production. If the command described above fails, check the .
4. The fourth step requires diffing and merging composer.json.old with composer.json installed with the Magento 2 software. These actions are possible with the aid of the following command:
| 1 | composer update | 
5. After manipulations with composer.json, you should update the Magento 2 database. Run the command below:
| 1 | php bin/magento setup:upgrade | 
6. The last step of this Magento 2 tutorial requires clearing var directory contents. The following command will help you to achieve your goal:
| 1 | rm -rf var/generation/* var/cache/* | 
Now, you know how to update Magento 2. If you have any questions, ask us in comments – Firebear team is always here to help you. For more information, check the .
Magento 2 Command Line Update
It is possible to upgrade Magento using the command line if your software was installed by downloading the meta package via the composer create-project command or was installed as the compressed archive.
Do not use the command line upgrade in case you cloned the Magento 2 GitHub repository. You should implement the aforementioned approach.
And don’t forget to perform , if you’re upgrading from 2.0.0 or 2.0.1.
If you set the Magento root directory to <your Magento install dir>/pub, perform the following prerequisites. In case you didn’t do this, dismiss the prerequisite section.
Prerequisite
Create another docroot or subdomain that utilizes the Magento installation directory as the root. The should be run using that subdomain.
Command Line Update
1. Be log in to your Magento server as a file system owner.
2. Change to the directory with the installed Magento software (e.g. cd /var/www/html/magento2)
3. Run the following commands:
| 1 2 | composer require <product> <version> --no-update composer update | 
For Magento CE 2.0.4, enter this command:
| 1 2 | composer require magento/product-community-edition 2.0.4 --no-update composer update | 
For Magento EE 2.0.4 – this one:
| 1 2 | composer require magento/product-enterprise-edition 2.0.4 --no-update composer update | 
In case of an error related to a missing .gitignore files, check .
4. Enter your if necessary.
5. Now, you should update your database schema and data. Run this command:
| 1 | php bin/magento setup:upgrade | 
6. Then, enable cache:
| 1 | php bin/magento cache:enable | 
7. Access your storefront to check if everything went as expected. In case of the following error:
| 1 | We're sorry, an error has occurred while generating this email. | 
perform the following tasks:
- 
First of all, reset . Now, you should be logged in as a user with root privileges. 
- 
Clear the following directories: 
| 1 2 3 | <your Magento install dir>/var/cache  <your Magento install dir>/var/page_cache  <your Magento install dir>/var/generation | 
- Try again
 
                
								
			
 
            






