Install 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 from Magento.
If you downloaded an archive from GitHub, this method won’t work because the
composer.jsonfile doesn’t contain the
You can use this method of getting sample data for both Magento Open Source or Magento Commerce, but you must use the same authentication keys you used to install Magento.
If you encounter errors, such as
Could not find package... or
...no matching package found..., make sure there aren’t any typos in your command. If you still encounter errors, you may not have access to the right Composer repositories, especially if your using Magento Commerce. Contact Magento support for help.
You can use Composer to install sample data either before or after installing Magento; however, there might be additional tasks.
If you’re a contributing developer, refer to Install by cloning repositories.
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
If you’re installing sample data after installing Magento, you must also run the following command to update the database and schema:
php <your Magento install dir>/bin/magento setup:upgrade
You are required to authenticate to complete the action.
The following authentication 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.
Install the Magento software
After sample data installation is complete, install the Magento software using the command line.