Magento 2.0.18 is the final 2.0.x release. After March 2018, Magento 2.0.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Uninstall or reinstall Magento

First steps

  1. Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.

If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:

su <Magento file system owner> -s /bin/bash -c <command>

If the Magento file system owner does not allow logins you can do the following:

sudo -u <Magento file system owner>  <command>
  1. To run Magento commands from any directory, add <magento_root>/bin to your system PATH.

Because shells have differing syntax, consult a reference like

bash shell example for CentOS:

export PATH=$PATH:/var/www/html/magento2/bin

You can also run the commands in the following ways:

  • cd <magento_root>/bin and run them as ./magento <command name>
  • <magento_root>/bin/magento <command name>
  • <magento_root> is a subdirectory of your web server’s docroot. Need help locating the docroot?

In addition to the command arguments discussed here, see Common arguments.


Before you use this command, you must install the Magento software.

Update the Magento software

To update the Magento software:

  • If you installed the software from an archive or if you used ‘composer-create-project’, use the Component Manager or System Upgrade utilities.
  • If you are a contributing developer (that is, you used git clone), see Contributing developers—update, reinstall Magento.

Reinstall the Magento software

This section discusses how to uninstall and then reinstall the Magento software with the latest version.

The way you reinstall the Magento application from the command line depends on your role:

Reinstall as a system integrator

To reinstall the Magento software as a system integrator:

  1. Log in to your Magento server as a user with permissions to modify files in the Magento file system (for example, the switch to the Magento file system owner.
  2. Enter the following commands in the order shown:

    cd <your Magento install dir>
    git pull origin develop
    php bin/magento setup:uninstall
    • If git pull origin develop fails, see troubleshooting.
    • To use your existing Magento software version , omit the git pull origin develop command.
  3. Install the Magento software:

Uninstall the Magento software

Uninstalling the Magento software drops and restores the database, removes the deployment configuration, and clears directories under var.

To uninstall the Magento software, enter the following command:

magento setup:uninstall

The following message displays to confirm a successful uninstallation:

[SUCCESS]: Magento uninstallation complete.

Optionally keeping generated files

By default, magento setup:upgrade clears compiled code and the cache. Typically, you use magento setup:upgrade to update components and each component can require different compiled classes.

However, in some situations (particularly, deploying Magento to production), you might wish to avoid clearing compiled code because it can take some time. (The cache is still cleared.) To update the Magento database schema and data without clearing compiled code, enter:

magento setup:upgrade --keep-generated

The optional --keep-generated option should be used only in limited circumstances by experienced system integrators. --keep-generated should never be used in a development environment.

Improper use of this optional parameter can cause errors during code execution.

  1. Install the Magento software: