Installing Magento 2 Sample Data
Contents
Magento 2 is an effective e-commerce platform, installing sample data might help you better comprehend its features and design. You can use the Magento 2 Sample Data to explore the capabilities and customization possibilities of the platform by using dummy goods, categories, and other components. We’ll walk you through installing Magento 2 Sample Data in this article.
Installing Magento 2 Sample Data Prerequisites
Before you begin, make sure you have the following in place:
- A working installation of Magento 2.
- Command line access to your server.
- Administrative access to your Magento 2 store.
Magento 2 Backup Your Website
It’s crucial to backup your Magento 2 store before making any big changes so that you can restore it if something goes wrong.
Access the Command Line Interface
Go to the root directory of your Magento 2 installation by opening a terminal or command prompt.
Magento Enable Maintenance Mode
It’s a good idea to enable the maintenance mode during the process of installation to avoid any problems. Use the command as follows:
OR
php bin/magento maintenance:enable
Magento Download Sample Data
From the Magento GitHub repository, you can get the Magento 2 Sample Data package. To download and extract the sample data, use these commands:
composer require magento/module-sample-data --no-update
composer require --dev allure-framework/allure-phpunit:~1.2.0 friendsofphp/php-cs-fixer:~2.18.0 lusitanian/oauth:~0.8.10 magento/magento-coding-standard:~4.1.0 magento/magento2-functional-testing-framework:2.4.5 pdepend/pdepend:2.5.0 phpmd/phpmd:@stable phpunit/phpunit:~6.5.0 sebastian/phpcpd:~3.0.0 squizlabs/php_codesniffer:3.4.0 --sort-packages --no-update
composer update
Magento Install Sample Data
You can install the example data using the following command after downloading it:
php bin/magento setup:upgrade
Compile and Deploy Static Content
Compile the code and deploy static content with the following commands:
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
Disable Maintenance Mode
You can disable maintenance mode by running:
php bin/magento maintenance:disable
Clear Cache
Clear the cache to ensure that your sample data is properly displayed:
php bin/magento cache:clean
Congratulations, you’ve just installed Magento 2 Sample Data successfully! Now that you can explore the platform with fake content, categories, and goods, you can learn more about Magento 2’s features and customization possibilities.