we can download magento2 in 3 ways.
1) Direct Download
2) Using COMPOSER
3) Using GIT
Step1: First you need to check composer install on system or not.
Type below command on your console to check composer installation
composer -help
If not install than install it . using below command.
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
The first command install Composer into your local directory,
the second will move the composer.phar file to a directory
where it can be accessed globally by your system.
Again check below command
composer -help
Step 2: Install magento project on local machine, Type command on console.
composer create-project magento/project-community-edition magentodemo
root@system:/var/www/html# composer composer create-project magento/project-community-edition magentodemo
you see below output on your console
Installing magento/project-community-edition (2.0.2)
- Installing magento/project-community-edition (2.0.2)
Downloading: 100%
Created project in Magento
Loading composer repositories with package information
Authentication required (repo.magento.com):
Username: bfba1bb4bdfdcb63d8458457728f
Password:
Do you want to store credentials for repo.magento.com in /home/gaurav/.composer/auth.json ? [Yn] Y
Step3: After this you need username and password
https://www.magentocommerce.com/
and login into your account and than go to Develoers >> Secure Keys and generate key here.
Basically public key is belong to Username
Private key is belong to Password
Step4: Give the permission of the folder
sudo chmod -R 777 magentodemo/
Step5: After that put below url on your local browser.
http://localhost/magentodemo/
If you want to add sample data on your project than run
below command on console after complete install project.
php <your Magento install dir>/bin/magento sampledata:deploy