Command-line upgrade to Magento 2.1 with sample data
Command-line upgrade to Magento 2.1 with sample data
These instructions apply to Magento Community Edition (CE) and Magento Enterprise Edition (EE) users only if all of the following are true:
- You have installed optional sample data
- You’re upgrading to Magento 2.1 (including a Release Candidate) from any earlier version using the command line
To upgrade to Magento 2.1 sample data using the command line:
- Log in to your Magento server as, or switch to, the Magento file system owner.
- Change to the Magento installation directory.
-
Back up your current
composer.json
:cp composer.json composer.json.bak
-
Enter one of the following commands to upgrade the Magento software version to 2.1.0 (GA release):
composer require <product> <version> --no-update composer require <sample data module-1>:<version> ... <sample data module-n>:<version> --no-update
-
Magento Open Source:
composer require magento/product-community-edition 2.1.0 --no-update composer require magento/module-bundle-sample-data:100.1.0 magento/module-widget-sample-data:100.1.0 magento/module-theme-sample-data:100.1.0 magento/module-catalog-sample-data:100.1.0 magento/module-customer-sample-data:100.1.0 magento/module-cms-sample-data:100.1.0 magento/module-catalog-rule-sample-data:100.1.0 magento/module-sales-rule-sample-data:100.1.0 magento/module-review-sample-data:100.1.0 magento/module-tax-sample-data:100.1.0 magento/module-sales-sample-data:100.1.0 magento/module-grouped-product-sample-data:100.1.0 magento/module-downloadable-sample-data:100.1.0 magento/module-msrp-sample-data:100.1.0 magento/module-configurable-sample-data:100.1.0 magento/module-product-links-sample-data:100.1.0 magento/module-wishlist-sample-data:100.1.0 magento/module-swatches-sample-data:100.1.0 magento/sample-data-media:100.1.0 magento/module-offline-shipping-sample-data:100.1.0 --no-update
-
Magento EE:
composer require magento/product-enterprise-edition 2.1.0 --no-update composer require magento/module-bundle-sample-data:100.1.0 magento/module-widget-sample-data:100.1.0 magento/module-theme-sample-data:100.1.0 magento/module-catalog-sample-data:100.1.0 magento/module-customer-sample-data:100.1.0 magento/module-cms-sample-data:100.1.0 magento/module-catalog-rule-sample-data:100.1.0 magento/module-sales-rule-sample-data:100.1.0 magento/module-review-sample-data:100.1.0 magento/module-tax-sample-data:100.1.0 magento/module-sales-sample-data:100.1.0 magento/module-grouped-product-sample-data:100.1.0 magento/module-downloadable-sample-data:100.1.0 magento/module-msrp-sample-data:100.1.0 magento/module-configurable-sample-data:100.1.0 magento/module-product-links-sample-data:100.1.0 magento/module-wishlist-sample-data:100.1.0 magento/module-swatches-sample-data:100.1.0 magento/sample-data-media:100.1.0 magento/module-offline-shipping-sample-data:100.1.0 magento/module-gift-card-sample-data:100.1.0 magento/module-customer-balance-sample-data:100.1.0 magento/module-target-rule-sample-data:100.1.0 magento/module-gift-registry-sample-data:100.1.0 magento/module-multiple-wishlist-sample-data:100.1.0 --no-update
To upgrade to a Release Candidate, append
-rc<x>
to the version of each module. For example,-rc3
. -
-
Update dependencies:
composer update
- If prompted, enter your authentication keys.
- Wait for dependencies to update.
Finish your upgrade
After you’ve reset file system permissions:
- If you haven’t done so already, log in to your Magento server as, or switch to, the Magento file system owner.
- Change to your Magento installation directory.
-
Manually clear the
var/cache
,var/page_cache
, andvar/generation
directories.A sample command follows:
rm -rf var/cache/* var/page_cache/* var/generation/*
-
Enter the following command from your Magento installation directory:
php bin/magento setup:upgrade
Apply file system permissions and ownership
As part of the sample data upgrade process, you must apply current file system permission and ownership as discussed in the following sections. Failure to do so will cause your upgrade to fail.
For more information about file system ownership and permissions since the Magento 2.0.6 release, see Overview of ownership and permissions.
One-user ownership and permissions
If you run the Magento application as one user (which is typical of shared hosting environments), change file system permissions and ownership as follows:
cd <your Magento install dir>
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod g+w {} \;
chmod u+x bin/magento
To optionally enter all commands on one line, enter the following assuming Magento is installed in /var/www/html/magento2
:
cd /var/www/html/magento2 && find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+w {} \; && chmod u+x bin/magento
After you set file system permissions, manually clear the var/cache
, var/page_cache
, and var/generation
directories.
A sample command follows:
rm -rf var/cache/* var/page_cache/* var/generation/*
Two-user ownership and permissions
If you run the Magento application with two users, enter the following commands as a user with root
privileges:
cd <your Magento install dir>
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
chown -R :<web server group> .
chmod u+x bin/magento
To optionally enter all commands on one line, enter the following assuming Magento is installed in /var/www/html/magento2
and the web server group name is apache
:
cd /var/www/html/magento2 && find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \; && chown -R :apache . && chmod u+x bin/magento