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
- Verify authentication keys (Private and Public key) is available or not.
- If not generate new authentication keys from Magento https://marketplace.magento.com/
- 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 the refer :
http://www.mr-jute.com/?p=2056 - Run following command in your root directory of magento2
root>php bin/magento sampledata:deploy
- 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. - 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.
- Before execute the “php bin/magento setup:upgrade” there are no sample data related modules will be in your vendor folder.
root>vendor/magento
- 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.
- Once after successful execution, sample data will be available in your magento.
- Optionally, you can do cache clear/flush and content deploy if required.