Recently we started getting ready with the new Magento 2 platform. In this blog, I will show how to install Magento2 with sample data via command line. I have setup Magento2 Demo Store with sample data, you can play both front-end and back-end.

I have made following assumptions to install Magento2. In case if you have different environment, please replace/update accordingly.

OS: Ubuntu 14.04.2 LTS
Magento root (path): /home/magento2/public_html


Make sure you have following application installed in your server.

Apache 2.2 or 2.4
PHP 5.6.x or 5.5.x
MySQL 5.6.x

See detail at "Step 1: Verify your prerequisites"

1) Install Composer

$cd /usr/bin
$curl -sS | php
$mv composer.phar composer

2) Clone Magento2

$cd /home/magento2/public_html
$git clone (alternatively git clone

This will create magento2 folder. Go inside magento2 folder and move everthing in /home/magento2/public_html

$cd magento2
$mv * ../
$mv .htaccess ../
$mv .git ./

Note: If get error like:

"The program 'git' is currently not installed. You can install it by typing: apt-get install git,
Install the git by:

$apt-get install git

3) Update installation dependencies

Go back to your magento2 root directory.

$cd /home/magento2/public_html
$composer install

*PHP extension check
It will check if required php extension is enabled. If not it will return you message

Problem 1
- The requested PHP extension ext-gd * is missing from your system.
Problem 2
- The requested PHP extension ext-mcrypt * is missing from your system.
Problem 3
- The requested PHP extension ext-curl * is missing from your system.
Problem 4
- The requested PHP extension ext-intl * is missing from your system.

In that case, you can install them by:

$apt-get install php5-gd php5-mcrypt php5-curl php5-intl

Enabling php module:
php5enmod <module_name> for example to enable mcrypt

$php5enmod mcrypt

4) Install Magento

Go back to your magento2 root directory (in case you are not there)

$cd /home/magento2/public_html

$php bin/magento setup:install --base-url= \
--backend-frontname=admin \
--db-host=localhost --db-name=magento2 --db-user=magento2 --db-password="mypassword" \
--admin-firstname=Krishna --admin-lastname=Sunuwar \
--admin-user=admin --admin-password=admin123 --language=en_US \
--currency=USD --timezone=America/Chicago
Detail guide:

5) Install Sample Data

a) Add magento repository:

$composer config repositories.magento composer

b) Update require list in composer.json

$composer require magento/sample-data:0.74.0-beta9

Note: This will also downloads necessary library

c) Run import process
Make sure you are in magento2 installation root directory.

$cd /home/magento2/public_html

Remove the fixtures from vendor/magento/sample-data-fixtures/fixtures/Sales/orders.csv
and dev/tools/Magento/Tools/SampleData/fixtures/Sales/orders.csv. In other word, delete all content from those two files. For some reason in sample-data:0.74.0-beta9 version, order import fails.

Run import tool:

$php dev/tools/Magento/Tools/SampleData/install.php --admin_user=admin

Detail guide:

5) Deploy static file

$php magento setup:static-content:deploy en_US

*Install xls extension in case you got "Autoload error: Class XSLTProcessor does not exist"
$apt-get install php5-xsl

**Disable cache (clean and flush)

$php magento cache:disable --all
$php magento cache:clean --all
$php magento cache:flusy --all

Detail guide: