Close [x]

Install using Composer

Edit this page on GitHub

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.

  1. Log in to the Magento server as, or switch to, the Magento file system owner.
  2. Clone the Magento 2 GitHub repository.

  3. Update dependencies by running composer install.

  4. Change to your Magento installation directory.

    For example, /var/www/html/magento2

  5. Require the https://repo.magento.com repository, which contains the sample data code:

    composer config repositories.magento composer https://repo.magento.com
    
  6. 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.

Complete the sample data installation

After you install the sample data, log in to your Magento server as, or switch to, the Magento file system owner and enter the following command:

php <your Magento install dir>/bin/magento setup:upgrade