Site Building

11.6. Manually Downloading Module or Theme Files for Drupal 8, 9, and 10

Goal

Manually download module or theme files and upload them to your site, if the website or Drush methods for installing or updating a module or theme do not work, or if you are placing a custom-written module or theme.

Site prerequisites

You need to be facing any of the following to perform the manual download described in this topic:

Skip this topic if none of the above applies to you. If you are using Composer to manage the files in your site, follow the file updating steps in Section 3.5, “Using Composer to Download and Update Files” instead of this topic.

Steps

Sprout Video

If you are installing a module or theme from Drupal.org, follow the downloading instructions, and then the uploading/unpacking instructions. If you created the module or theme, skip the downloading step. Instead, create an archive file (that you know how to extract on the server) and proceed with the steps in uploading/unpacking, using whatever method is appropriate for the way you initially created the archive file.

Downloading the files

  1. Open the module or theme project page on drupal.org; for example, the Admin toolbar page (https://www.drupal.org/project/admin_toolbar).
  2. Scroll to the Downloads section near the bottom of the page.

    Image
    Downloading module files

  3. Click tar.gz to download the file to your computer. Alternatively, if you have terminal access to your hosting server (running Linux), you can copy the link address for the tar.gz file from your browser, and use this command to download the file (substituting the copied URL):

    wget https://ftp.drupal.org/files/projects/admin_toolbar-8.x-2.4.tar.gz

Uploading the files to your site and unpacking them

  1. If you are adding a new module or theme, create subdirectories in your top-level modules and themes directories (if they don’t already exist). Typically, people make a contrib subdirectory for contributed modules and themes that are downloaded from Drupal.org, and a custom subdirectory for modules and themes that they created. Your modules directory might look like this:

    Image
    Suggested directory structure for modules

  2. If you are replacing an existing module or theme with an updated version, put the site into maintenance mode. See Section 11.2, “Enabling and Disabling Maintenance Mode”.
  3. If you are replacing an existing module or theme with an updated version, find and delete all the existing files and directories for the existing module or theme. Modules are normally located in directories under the top-level modules directory, and themes are normally located in directories under the top-level themes directory.
  4. Upload the .tar.gz file (or whatever archive you created) to your site. Place it in either the same location from which you deleted the directory (if replacing an existing module or theme) or the appropriate subdirectory of modules or themes (if adding a new module or theme).
  5. Extract the files from the .tar.gz archive (or whatever archive you created), making a subdirectory in the same location as the archive file. If you do not have terminal access, or your hosting server is not running Linux, your hosting control panel’s file manager should provide a way to extract the files. If you have terminal access to your hosting server (running Linux) and you are using a tar.gz file, you can use a command like:

    tar -xzf admin_toolbar-8.x-2.4.tar.gz
  6. Delete the compressed file from the server, unless your unpacking method already deleted it.
  7. Refer to Section 11.3, “Downloading and Installing a Module from Drupal.org, Section 11.5, “Downloading and Installing a Theme from Drupal.org, Section 13.6, “Updating a Module”, or Section 13.7, “Updating a Theme” to complete the installation or update of the module or theme. Start at the step after the automatic download has been completed.

Expand your understanding

  • If you work with multiple environments (for example, a local development site and a production site) you will have to repeat the steps on each environment, or re-clone the environment. See Section 11.8, “Making a Development Site”.
  • If you added a new theme, navigate in the Manage administrative menu to Appearance (admin/appearance) and uninstall the old theme.