How to install extensions in Magento 2?

Installing Magento 2 extension is a easy task .. you just need to extract your extension zip file and place the folder inside your Magento 2 app/code directory so that the structure should be like app/code/namespace/module-name

Then you have to run some commands for registering your Magento 2 extension

open terminal inside your Magento 2 directory , parallel to the app directory run these commands-

[1] sudo chmod -R 777 /path of Magento 2 folder such as /opt/lampp/htdocs/Training/Magento_2.0 ( giving read write permission to your magento 2 directory)

if you are using Linux operating system then you have to run this command . for windows it is not necessary.

[2] /opt/lampp/bin/php bin/magento setup:upgrade (for registering your extension)

[3] /opt/lampp/bin/php bin/magento setup:di:compile (for compiling your extension code)

now flush your cache , delete cache folder from your Magento 2 var directory.