How to install Magento 2

Are you migrating to Magento 2? Thinking of installing Magento 2 with the Composer but not sure how to begin the process? Do not worry. Magento 2 installation is easy and stress-free when you have a step-by-step instruction guide to help you out. Trust for making the installation process quick and easy. We have the right information to help you get started.

This article gives you brief on how to install Magento 2 via Composer | Command line

Just to note that i am installing Magento 2 on Ubuntu 14.04 LTS on xampp server

PHP ver. 5.6
MySql ver. 5

Step 1 : Setup/Install Composer.

The first question comes into mind is what is Composer? I will answer this briefly...

"Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you."

To get in depth detail on Composer please visit this link

To install composer in your system, you will have to execute below command in terminal

sudo wget -O /usr/local/bin/composer

Step 2 : Then make the composer file executable

sudo chmod +x /usr/local/bin/composer

Step 3 : Download Magento 2 from repository using composer.

composer create-project --repository-url= magento/project-community-edition magento2/

NOTE: This above command will ask you for username and password of repository account, for this you will have to create account in magento connect and create secure key(username/password). The above command will download latest version of magento in magento2 directory. The above command will also ask you to save the authorization key(username/password of repository) in magento var directory, this may be helpfull for future magento upgrade, if you save the authorization key then this will not ask you for username/password during magento upgrades.

Step 4 : Check PHP and path settings.

it is assumed that you have already configured PHP to use as command line, but just in case you would like to check whehter your PHP is configured to use as command Line then execute below command in terminal

php -v

The above command will show the version of PHP install in your system.

Step 5 : Installing Magento 2.

All magento related command has to be executed from magento project root directory, in our case it is "magento2" directory.

php -f bin/magento setup:install --base-url=http://localhost/magento2/ --db-host=localhost --db-name=dev_magento2 --db-user=dev_magento2 --db-password=S8s8RF2bnmWDSmxa --admin-firstname=Local --admin-lastname=Admin --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago


php -f bin/magento setup:install --base-url=http://localhost/magento2/ --db-host= --db-name=dev_magento2 --db-user=dev_magento2 --db-password=S8s8RF2bnmWDSmxa --admin-firstname=Local --admin-lastname=Admin --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago

Please make sure to change the values of below options in above commands as per your local set up >>


NOTE: Once installation completes, it will give you magento admin url, you can save it OR you can get/change magento admin url from app/etc/env.php

Step 6 : Installing sample data

Below command will download sample data.

php bin/magento sampledata:deploy

Below command will install sample data

php bin/magento setup:upgrade

Once sample data installation completes it may give you a message – “Please re-run Magento compile command”, so please execute following command in terminal:

php bin/magento setup:di:compile

if you face any memory limit issue, then please run below commands for upgrade and compilation

php -d memory_limit=-1 bin/magento setup:upgrade
php -d memory_limit=-1 bin/magento setup:di:compile

For any further details on installing Magento 2 please refer:

Leave a Comment