There are different ways to install Magento 2 module:

1. Install Magento 2 Extension via the Composer

This installation method is the most preferred, but not all Magento 2 extension vendors provide a possibility to install their modules via the Composer.

Composer is the package manager for the PHP, it allows you to manage dependencies of Magento 2 extensions and PHP libraries. It also facilitates the upgrade process of Magento2 & Magento2 Extensions.

Please, open Magento 2 directly in the Command Line Interface (CLI) and run next commands to install Magento 2 module using the Composer:

composer require vendorname/module-name
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

vendorname/module-name is a package name of the extension, you can get it from the vendor.

If you have received the message "No command 'composer' found" during the installation, please, install composer first.

 

2. Install Magento 2 Extension from Archive

This is the most common method since Magento 1.x times. Please, follow the steps bellow to install the module in this way:

1. Unzip extension archive.

2. Upload "app" folder from archive over FTP or SFTP to your Magento 2 directory on the web-server.

3. Run the commands in the Magento 2 directory via CLI:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy