2

I have setup magento 2 in linux by Clone the Magento repository method.

cloned magento 2 form this github repository. https://github.com/magento/magento2

Branch - develop (Here all magento modules available in app/code/Magento folder not in vendor/magento folder)

Magento 2(version - 2.2.0-dev) working fine and run without sample data.

But now when I run php bin/magento sampledata:deploy command it gives me error.

root@root:/var/www/html/magento2# php bin/magento sampledata:deploy

enter image description here

I am using develop branch where all magento modules by default available in app/code/Magento directory.

please help me ASAP. I am new to magento 2.

0

First need to Download sample data

download data form git https://github.com/magento/magento2-sample-data

after that run

php bin/magento sampledata:deploy
  • Thank you for answering me but its also not working. can you please add steps with command in your answer? – Hiren Shah Feb 7 '17 at 18:50
  • kindly answer in details with steps – Manoj Deswal Oct 3 '17 at 5:08
0

When you are using repository approach to install your Magento instance. Then you need to follow below steps to ensure sample data works in your Magento instance.

Pull your sample data first.

Pull sample data repository to a separate directory other than your Magento instance. For example, if your M2 instance is at /var/www/html/magento2 directory, then you can create a new directory at var/www/html/m2-sampledata.

Also, when you pull the sample data, you should make sure that you are pulling the corresponding branch to your M2 instance. For example, here you are using develop branch, so you should also use develop branch of sample data

Note: Magento recommends to use a stable release even if you are using repository approach to install your Magento instance. Develop branch is for those who would like to contribute to the Magento code base.

All these you can achieve using below steps. (if you are using ubuntu)

mkdir /var/www/html/m2-sampledata
cd /var/www/html/m2-sampledata
git init
git remote add origin https://github.com/magento/magento2-sample-data
git pull origin develop

So here we just created a directory, cd into that directory, initialized git, added the remote repository and then pulled the develop branch. If you are using some other branch in your M2 instance then you need to pull that branch.

Create Symlinks

Now we have downloaded sample data. But it is available in another directory and our M2 instance has no clue about this sample data. So we need to let our M2 instance to know about the sample data files.

Luckily, M2 sample data provide us some tricks to achieve this. Execute below steps.

(Assumes you are at m2-sampledata directory in your CLI)

cd dev/tools
php -f build-sample-data.php -- --ce-source="<your Magento Open Source install dir>"

Replace the install directory with your M2 instance absolute path. For ubuntu, it would be most probably looks like

php -f build-sample-data.php -- --ce-source="/var/www/html/magento2"

If your m2 instance directory is magento2.

This will create symlinks between your M2 instance and M2 Sample data directory.

Install Sample Data

cd /var/www/html/magento2
php bin/magento setup:upgrade
php bin/magento setup:di:compile

Now we are CD into our M2 instance directory, then perform upgrade and compilation. You are done.

In addition to this, there should be some permissions to be correctly set in order to make it work. For more info, you can see all these in the official documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.