简体   繁体   中英

install magento2 with sample data

When I install the magento2, I am unable to install sample data, the 'Use Sample Data' is disabled. I am unable to install sample data. How can I fix it ?

Note : I was able to install magento2 without sample data.

For sample data, create a new Database. Before setting up magento, first download 'magento-sample-data-1.6.0.0.tar.gz' file from here http://inchoo.net/magento/magento-sample-data/

Extract it which will have a sql file. Import it from phpmyadmin or terminal into your newly created database.Also copy media/catalog folder into your magento's media

Then install magento using same database name.

In the docs http://devdocs.magento.com/guides/v2.0/install-gde/install/composer-clone.html there is a box which says

We're aware of issues with installing optional sample data after cloning the develop branch. If you plan to use sample data, clone the master branch.

And you follow that link to here to learn about the problem: http://devdocs.magento.com/guides/v2.0/install-gde/trouble/tshoot_sample-data.html

And then grab the master branch,

You might have better luck with the sample data: http://devdocs.magento.com/guides/v2.0/install-gde/install/sample-data.htm

You can install magento sample data after or before magento setup.

Please follow the step is in this tutorial. it is working.

http://devdocs.magento.com/guides/v2.0/install-gde/install/sample-data.html#instgde-install-sample-intro

when you following steps and complete the installation magento sample data before magento setup after magento 'Use Sample Data' will enable for you. if you have already setup magento without sample data, you can also install sample data after magento setup.

You can now install Magento 2 sample data before or after installing the software, using either the master (more stable) or develop (more recent) branch. If you use the Setup Wizard, there is no longer a Use Sample Data check box.

Note that by GA, there will also be a command-line installation option.

Summary of steps:

  1. Clone the Magento 2 Github develop or master branch.
  2. Clone the Magento 2 sample data repo.
  3. Link the repositories. php -f /deve/tools/build-sample-data.php -- --ce-source=""
  4. Set file system permissions and ownership on the sample data clone dir.
  5. Install Magento.

If Magento is already installed, run:

php /bin/magento setup:upgrade

Reference: http://devdocs.magento.com/guides/v2.0/install-gde/install/web/install-web-sample-data.html

您可以通过命令行安装示例数据:

php <your Magento install dir>/bin/magento sampledata:deploy

Just use <php -dmemory_limit=6G /bin/magento sampledata:deploy> command and then upgrade and setup static content. Don't forget to flush the cache

install sample-data after Magento setup. use this command for installing sample data

php bin/magento sampledata:deploy

Here system will require username and password for your magento.com. Use your magento store Public and private keys as username and password. than run this command

php bin/magento setup:upgrade

Than run this command

php bin/magento setup:static-content:deploy -f

- Download Magento Project using composer

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.0

- Install Magento 2 using the command

php bin/magento setup:install --base-url="http://localhost/magento240" --db-host="localhost" --db-name=magento240_db --db-user=root --db-password=admin --admin-firstname="Admin" --admin-lastname="Magento" --admin-email="admin@gmail.com" --admin-user="admin" --admin-password="admin@123" --use-rewrites="1" --backend-frontname="admin"

Install sample data modules:

  • Using composer:
  1. Add dependencies to the composer.json : composer require magento/module-bundle-sample-data magento/module-widget-sample-data magento/module-theme-sample-data magento/module-catalog-sample-data magento/module-customer-sample-data magento/module-cms-sample-data magento/module-catalog-rule-sample-data magento/module-sales-rule-sample-data magento/module-review-sample-data magento/module-tax-sample-data magento/module-sales-sample-data magento/module-grouped-product-sample-data magento/module-downloadable-sample-data magento/module-msrp-sample-data magento/module-configurable-sample-data magento/module-product-links-sample-data magento/module-wishlist-sample-data magento/module-swatches-sample-data magento/sample-data-media magento/module-offline-shipping-sample-data --no-update
  2. Run: composer update
  • Using magento:
  1. Deploy sample data: bin/magento sampledata:deploy
  2. Enable sample data modules (it's important!): bin/magento module:enable Magento_CustomerSampleData Magento_MsrpSampleData Magento_CatalogSampleData Magento_DownloadableSampleData Magento_OfflineShippingSampleData Magento_BundleSampleData Magento_ConfigurableSampleData Magento_ThemeSampleData Magento_ProductLinksSampleData Magento_ReviewSampleData Magento_CatalogRuleSampleData Magento_SwatchesSampleData Magento_GroupedProductSampleData Magento_TaxSampleData Magento_CmsSampleData Magento_SalesRuleSampleData Magento_SalesSampleData Magento_WidgetSampleData Magento_WishlistSampleData
  3. Remove old files: rm -rf var/cache/* var/page_cache/* var/generation/*
  4. Upgrade magento files: bin/magento setup:upgrade
  5. Recompile files: bin/magento setup:di:compile
  6. Do reindex: bin/magento indexer:reindex
  7. Deploy static content: bin/magento setup:static-content:deploy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM