Drupal Training: How To install Drupal Modules
Drupal is a comprehensive website builder that lets you create anything, as long as you know how to both install modules and how to code. That’s why today, we’re going to go over how to install Drupal modules. In this blog, you’ll learn how to add the module in various ways, enable it, configure it, and set user permissions.
Let’s get started!
Step 1: Add the moduleIf you’re installing the module as part of Drupal Core, go to step 2.
To find out if it's in core, go to the site's /admin/modules page. Core modules are already included so don't need to be added, but they may need to be enabled.
There Are Several Ways to Add Modules
There are several ways to add Drupal modules, such as from Drupal’s User Interface, Composer, and Ludwig. However, Ludwig is very limited in its modules and uses, so we won’t go over it here today.
We don’t recommend this if you’re not used to coding, but you can also install:
- Manually downloading the .zip or .tar.gz file. This only works for modules that don't have dependencies.
- Using the command line. This requires either Drush or Drupal Console.
Below are quick steps for each of these three methods.
Add a Drupal Module Using Drupal's User Interface (Easiest)
This is the easiest method to install modules. It takes four steps.Step One:
All you need to do is go to the module’s page and copy the “tar.gz” link (under the downloads section). Depending on your device and browser, you might do this by right clicking and selecting “Copy link address.”Step Two:
Next, log into your website’s administrative backend, and go to “Extend,” then “Install new module.” If you clicked on “Extend” instead of navigating via the drop down menu, click on the blue “Add new module” button.Step Three:
In the “Add from a URL” field, paste in the module link from the first step and hit “Continue.” The files will be downloaded from the module directly.Step Four:
Click Enable newly added modules to return to the Extend page.
If you are trying to enable an existing module, see step two.
Add a Drupal Module with Composer (Preferred)
Most developers install modules via Composer. The recommended method for adding a dependency to your project is using Composer. This assumes you're alreadymanaging your project with Composer.
If you are, then all you need to do is get the module’s code and determine the module’s short name. For example, the short name for the Geofield Moduleis Geofield.
One that is known, enter the following command at the root of your site using the module’s short name: composer require Drupal/geofield
Once the command is complete you should see a message indicating the module has been added to your project's composer.json file as a dependency and the related code has been downloaded.
For more information, and a video demonstration, we recommend these Drupal resources:
- Using Composer to Download and Update Files,
- Downloading contributed modules and themes using Composer
Step 2: Enable the Module
Once your module is installed, you have to enable it. This is really easy if the module was installed correctly.
Using the Drupal User Interface:
- Navigate to the Extend page (admin/modules) via the Manage administrative menu
- Locate the module you want to enable and check the box next to it
- Click Install to enable the new module
Step 3: Set User Permissions
The third step is one that is so often overlooked, but is crucial to ensuring your website is secure and usable. Setting the correct user permissions makes it so some users won’t/will be able to use your newly installed modules.
For security, permissions are not initially enabled, after adding a new module, for anyone except the Administrator.
The administrator can update user permissions at any time in the “People” tab of the administrative backend.
Step 4: Configure a Module
A few modules work without any need for setting permissions or configuring. Most, however, require one or both. You'll find configuration instructions on each module's page, in its documentation, or readme.txt file.
That’s it! Wipe your brow, you’re done! Not too difficult, was it? Now, onto your next Drupal project!
If you need a little help developing your Drupal project, reach out to us at Agile 451. Our owner, Danielle Hallet, worked on the very first Drupal project, so you could say that she’s a bit of an expert on the subject. So tell us about your project and we’ll be happy to help!