Magento 2 install folder

I am new to Magento 2 and was using composer to install it. Have already cloned the repo from Magento GitHub account.

One thing I couldn't find information about was when installing Magento 2 on localhost do I need to place it under this docroot /var/www/magento2 or can it live outside this folder structure? Fro example just under magento2?