In the recent post I have described how you can install and setup the Magento 2 via composer and command line (CLI), now in this post I am just describing how we can install the Magento 2 Sample data although this is optional but if anyone wants to install the sample products, categories, orders, customers, etc. they can do it via the command line, this is very easy and can be done just by using the steps given below
Step 1 : Login into your Magento 2 Server with SSH:
ssh your SSH username@your server IP
Step 2 : Now after the SSH connect lets navigate to the Magento 2 installation directory in my case /var/www/html/ewamagento2
Step 3 : Run this command
sudo php bin/magento sampledata:deploy
Step 4 : as soon as you will run this command this will ask for the username and password for repo.magento.com
Username: Public Key will be your username
Password: Private Key will be your password
If you have already your account you can use this to generate the access keys from
https://account.magento.com/applications/customer/login/ here:
– Go to https://account.magento.com/applications/customer/login/ – Login – After you are logged in, click My Access Keys link – On My Access Keys page, click on Generate Keys button – Then, you will see two keys (Public and Private) – Public Key will be your username – Private Key will be your password
So latest Sample data will be installed.
After sample data installed, you need to clean cache and run setup upgrade:
1. php -dmemory_limit=6G bin/magento setup:upgrade 2. chmod 777 var/ -R; chmod 777 generated/ -R; chmod 777 pub/static -R
make sure after the upgrade command we need to run the folder permission command.
Step 5 : After successful setup and upgrade command you will get the following message :
Please re-run Magento compile command so you can run the :
1. php bin/magento setup:di:compile 2. chmod 777 var/ -R; chmod 777 generated/ -R; chmod 777 pub/static -R
make sure after the compile command we need to run the folder permission command.
After this your Sample data like sample products, categories will installed successfully lets navigate to the store front and see all the categories and products.
Hope this helps. Stay tuned for the Magento 2 latest tutorial and updates, Hope you enjoyed reading, if you need the professional Magento 2 Development / PHP we can help you, just Click on the Link and send me your requirements.