The Easiest Way to install Sample data after installing Magento2

There are two different way we can install the sample data after you have done the Magento2 setup.

  • Install using Composer
  • Install by cloning repositories

Refer : https://devdocs.magento.com/guides/v2.3/install-gde/install/sample-data-after-magento.html

In my scenario, i am trying to install sample data using Composer . In case if you have download the Magento2 package from GitHub than this method won’t be workout. Before install the sample data verify

  1. Verify authentication keys (Private and Public key) is available or not.
  2. If not generate new authentication keys from Magento https://marketplace.magento.com/
  3. Once after generate new (or) using existing key than use Public key as your User name & Private key as your Password while running the below command in terminal. To generate key refer : https://jutesenthil.wordpress.com/2019/07/09/how-to-generate-your-authentication-keys-for-magento2/
  4. Run following command in your root directory of magento2
    root>php bin/magento sampledata:deploy
  5. Once after enter the username/password, the system will ask you want to store the credentials into your
    root>var/composer_home/auth.json file. This is optional, if you select than the details will be stored else it won’t be. My suggestion you don’t want to store this information.
  6. See above screenshot, after select Yes/No than the sample data download will be start and it will be stored in your
    root>var/composer_home/cache/files/magento directory. Now if system is ready to install the sample data.
  7. Before execute the “php bin/magento setup:upgrade” there are no sample data related modules will be in your vendor folder.
    root>vendor/magento
  8. Now Run “setup upgrade” command in your magento root directory. System will create a sample data in your magento setup.For example : I have taken screenshot for configurable module before and after how many related modules are present in our vendor directory.
    similar sample data folder will be create in your vendor folder after execute the setup upgrade command.
  9. Once after successful execution, sample data will be available in your magento.
  10. Optionally, you can do cache clear/flush and content deploy if required.

Save WATER !!! It will save you LATER!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s