Single machine deployment

This topic provides instructions for deploying updates to Magento on a production server using the command line.

This process applies to technical users responsible for stores running on a single machine with some themes and locales installed.

For less technical users, i.e. business users, we recommend using the System Upgrade feature in the Admin.

Assumptions

This guide does not apply if you used git clone to install Magento. Contributing developers should use this guide to update their Magento installation.

Deployment steps

  1. Log in to your production server as, or switch to, the Magento file system owner.

  2. Change directory to the Magento base directory:

    1
    
    cd <Magento base directory>
    
  3. Enable maintenance mode using the command:

    1
    
    bin/magento maintenance:enable
    
  4. Apply updates to Magento or its components using the following command pattern:

    1
    
    composer require <package> <version> --no-update
    

    package: The name of the package you want to update.

    For example:

    • magento/product-community-edition
    • magento/product-enterprise-edition

    version: The target version of the package you want to update.

  5. Update Magento’s components with Composer:

    1
    
    composer update
    
  6. Update the database schema and data:

    1
    
    bin/magento setup:upgrade
    
  7. Compile the code:

    1
    
    bin/magento setup:di:compile
    
  8. Deploy static content:

    1
    
    bin/magento setup:static-content:deploy
    
  9. Clean the cache:

    1
    
    bin/magento cache:clean
    
  10. Exit maintenance mode:

    1
    
    bin/magento maintenance:disable
    

Alternative deployment strategies

In Magento 2.2, a near-zero downtime deployment model will be available for a variety of complex environments, including Magento Commerce Cloud.

Related topics