Installing Modules from the Command Line

Body

This documentation is deprecated.

 

In addition to installing modules using the UI, you may also download and install modules from the command line:

  • The recommended way to download modules (and themes) is with Composer. However, you may still use Drush 8 or Drupal Console to download the modules, but it does not adjust your composer.json file.
  • Both Drush and Drupal Console will install modules and themes for you. (In Drupal 8 installing and enabling a module is the same.)

Downloading and installing modules from the command line is the fastest way to extend your installation.

Drush

In Drush 8 you can download a module using a command:

drush dl module_name

To install a module using Drush, execute the command below:

drush en module_name

Clear the cache using a command

drush cr

Go to the browser refresh the page. You will see the functionality of the module is added to the site.

Be sure that your version of drush is appropriate for your version of drupal. Otherwise you might encounter errors. See the documentation on installing drush.

Drupal Console

To install a module with Drupal console, execute the command below:

drupal moi module_name

With Drupal Console, you can download a module using

drupal mod module_name
Knowledge Category