Drupal modules extend site features & core functions by installing & uninstalling modules. Learn multiple methods to install modules in Drupal 8/9 using UI & Composer.
Use one of the following methods to install modules on the Drupal site:
Method 1: Installing a module using Composer
Complete the following steps to install a new module to your Drupal site using Composer:
- Ensure you have installed composer in your local environment for development.
- Open a terminal to access your local site.
- Using the cd command, navigate to your local Drupal site directory for example.
$cd /var/www/html/drupalpractice
where drupalpractice is a drupal folder.
- Execute the below command:
$composer require drupal/module-name
Where module-name is the project name from drupal.org.
example:
$composer require drupal/devel
where devel is contributed module.
- After installing the module, you should enable the module by either using Drush or by using Drupal User Interface.
To enable the module to your Drupal site using Drush, complete the following steps:
- Ensure you have installed Drush in your local environment.
- Open a terminal to access your local site.
- Using the cd command, navigate to your local Drupal site directory for example.
$cd /var/www/html/drupalpractice
where drupalpractice is a drupal folder.
- Execute the below command:
$drush en module-name
Where module-name is the project name from drupal.org.
example:
$drush en devel
Where devel is a contributed module.
Method 2: Installing a module using Drupal’s User Interface
To install a new module to your Drupal site using Drupal’s User Interface, complete the following steps:
- First, go to that module's page then copy the link “tar.gz” below the Downloads section at the bottom of that page (right-click on the tar.gz file in the image below) or download the tar.gz file.
- Copy a module’s URL i.e. click on ‘copy link address’ for installing.
- Then navigate to your site at /admin/modules/install, then paste that link in the URL box (requires FTP access) or upload a tar.gz file from downloads, then click continue.
- After installing the module, you should enable the module by either using Drush or by using Drupal User Interface.
To use Drupal User Interface to enable the module on your Drupal site, follow these steps:
- As an administrator, log in to your website.
- Navigate to the Module page by using one of the following points.
- Using the Manage administrative menu, go to the Extend page.
- In your address bar, go to http://your-sitename/admin/modules (where your-Sitename is your website’s server name or URL).
- In the list of modules, search the module you want to enable, and then select its checkbox.
- Scroll down to the bottom of the webpage, and then click Install.
After completion of installed and enabled a module in your website then configure the module’s settings or make changes to your website user permissions as per your project requirements. For more details of modules, ensure read the documentation provided by the module or on the module’s Drupal.org project page.
Conclusion
Drupal allows you to add modules to your Drupal site providing additional features by installing contribute modules and enabling core and contribute modules. Installing a Drupal module using composer or using Drupal’s User Interface is the simplest method.
Comments