Magento is a robust e-commerce platform, powering big brands to get the most out of their online business. It is loaded with a large number of useful features that help store owners to enhance their online store’s performance, and to give their customers an incredible web shopping experience.
There are still many store owners who are thinking to move their online business to Magento 2. Installing Magento 2 is the way forward for them. If you haven’t installed it yet, we have got you covered with a comprehensive guide on How to Install Magento 2
By default, you can easily install Magento sample data during the installation process. However, many people skip this step and I have seen queries about installing Magento 2 sample data after the platform installation. This guide will resolve all these queries!
Today, you will learn as to how to install Magento 2 sample data.
Open the SSH terminal and connect your Magento 2 store with it. Navigate to the root directory of your store to run the required CLI commands.
To install Magento 2 sample data, first run the following CLI command:
php bin/magento sampledata:deploy
It will ask about URL authentication to repo.magento.com. You have to enter username and password. To get the credentials, login to your Magento Marketplace account and then navigate to My Profile:
Next, click on Access Keys:
Now, click on Create a New Access Key to create one. However, if you have already created the access key, you can also use the existing one. The Public Key is the username and Private Key is the password for URL authentication. Enter them to the CLI. Type ‘Y’ and press the Enter key.
Now upgrade the setup by running the following CLI command:
php bin/magento setup:upgrade
Now just run the following commands one by one:
php bin/magento setup::di:compile
php bin/magento static-content:deploy -f
However, if you get any memory error message after running command to install Magento sample data, then update the command as follows:
php -d memory_limit=2G bin/magento sampledata:deploy
All done. You are good to go. Just launch your store and you will see that Magento 2 sample data has been successfully installed:
Installing Sample data to an online store is a great way to check the performance and interface of any platform, thus helping store owners to make a decision for the right platform.
I believe after following this tutorial you should now be able to install Magento 2 sample data. If you’re still facing any issues or want to add something, do leave your comment below and I will get back to you!
Frequently Asked Questions
Q. Can I install Magento 2 sample data manually rather then CLI?
Yes, you can install Magento 2 sample data manually. Just go Magento Resources and download Magento 2 version with sample data and install it to the root directory of your server.