Magento 2 Composer install command

To install Magento 2 via composer, you run the following shell command in your terminal on your server. Bear in mind I am assuming you have already installed the prerequisites which can be found here: http://devdocs.magento.com/guides/v2.1/install-gde/system-requirements-tech.html.
Don't forget to change the end part of this command - this is the directory where you would like to install Magento 2 ( I.e. /var/www/gurdeep/magento2 should be /your/install/directory)
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition /var/www/gurdeep/magento2
When you run this command for the first time, you will be prompted to enter a username & password to access the composer repository for Magento.
Authentication required (repo.magento.com): Username:
You can obtain this by logging into your Magento Marketplace account https://marketplace.magento.com and then clicking on the link called "My Access Keys" under the section "My Products"
Once you have entered the username & password, you will be asked if you would like to store these details in your composers auth.json file:
Do you want to store credentials for repo.magento.com in /home/gurdeep/.config/composer/auth.json ? [Yn]
My advice is to select Yes if you are installing on to your development environment.
See the following link for more information from Magento:
http://devdocs.magento.com/guides/v2.0/install-gde/prereq/integrator_install_ce.html