Install Sample data using Composer in Magento 2

install sample data using composer in magento 2

Let’s see how to install sample data in Magento 2 by using the composer.

To install sample data using composer follow below steps:

Step 1: Open SSH terminal to connect your magento store home directory.

Step 2: Run the following CLI command to install sample data.

php bin/magento sampledata:deploy

Step 3: Authenticate from, enter your username, and password. Login to your marketplace account and click on My Profile and navigate to My Products -> Access Keys.

Step 4: If you have already an access key, you can use that. Otherwise, you can create a new key by clicking on Create A New Access Key.

Step 5: You have two types of keys public and private:

Public Key: Use this is a username.
Private Key: Use this as a password.
Go to the SSH terminal and enter the username and password.

Step 6: Press the “Y” key and hit Enter to start the Magento 2 sample data installation process.

Note: If you are get a memory error message, run the following command.

php -d memory_limit=2G bin/magento sampledata:deploy

Step 7: After successfully installing Magento 2 sample data, run the following commands step by step.

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento setup:di:compile

Step 8: Navigate to your store’s frontend to see the sample date.

Please contact us at or call us at +91-8800519180 for any support related to Magento 2. You can also visit the Magento2 development page to check the services we offer.