How to Update Magento 2

- Fire development, Magento 2

Magento 2 tutorial: How to update the system

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

'

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 unix.stackexchange.com 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

run them as

Or use the following one:

In both cases, <your Magento install dir>  is a subdirectory of the web server’s docroot.

You may be also interested in additional command arguments!

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:

2. Use the following command, in case when the optional sample data has been installed:

3. Now, it’s time to get the latest code by updating your local repository:

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 official  troubleshooting.

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:

5. After manipulations with composer.json, you should update the Magento 2 database. Run the command below:

6. The last step of this Magento 2 tutorial requires clearing var directory contents. The following command will help you to achieve your goal:

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 official Magento 2 update guide.

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 these tasks, 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 System Upgrade utility 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:

For Magento CE 2.0.4, enter this command:

For Magento EE 2.0.4 – this one:

In case of an error related to a missing .gitignore files, check this documentation.

4. Enter your authentication keys if necessary.

5. Now, you should update your database schema and data. Run this command:

6. Then, enable cache:

7. Access your storefront to check if everything went as expected. In case of the following error:

perform the following tasks:

  • Try again

Source

'