Install sample data using Composer
This section discusses how to install sample data if you got the Magento software in any of the following ways:
- Downloaded a compressed archive
- Used
composer create-project
You can use this method of getting sample data if you used Magento Community Edition (CE) or Enterprise Edition (EE).
If you鈥檙e a contributing developer, see one of the other topics on the left side of this page.
See the following sections:
Sample data prerequisites
Before you install sample data, you must update Magento鈥檚 composer.json
to get components from https://repo.magento.com
.
- Log in to the Magento server as, or switch to, the Magento file system owner.
-
Update dependencies by running
composer install
. -
Change to your Magento installation directory.
For example,
/var/www/html/magento2
-
Require the
https://repo.magento.com
repository, which contains the sample data code:composer config repositories.magento composer https://repo.magento.com
- Continue with the next section.
Install released version sample data
To install sample data using the command line, enter the following command as the Magento file system owner:
php <your Magento install dir>/bin/magento sampledata:deploy
You are required to authenticate to complete the action.
Authentication error
The following error might display:
[Composer\Downloader\TransportException]
The 'https://repo.magento.com/packages.json' URL required authentication.
You must be using the interactive console to authenticate
If the error displays, change to your Magento installation directory and run composer update
, which will prompt you for your authentication keys.
Find us on