Installing Drupal

Installing Drupal root
Drupal Version

This section contains guides to help you with installing a new copy of Drupal.  Information on updating and upgrading existing Drupal sites can be found elsewhere in the handbook.

Where to Host Your Drupal Site?

Where to Host Your Drupal Site? esembrat3
Drupal Version

There are a number of ways you can host your Drupal site on campus, which is strongly recommended for any unit-level website.

All units can take advantage of the central OIT Web Hosting service.  This service can host many popular PHP based content management systems, including Drupal and WordPress.  For those looking to quickly setup a unit-level website, OIT Web Hosting supports Drupal Express, which will give you a jump start on building a Drupal based website by installing Drupal plus a number of standard add-on components, such as the official Georgia Tech website theme and page layout system.

Should you choose not to use OIT's services, some Schools, Colleges, and other units have their own externally hosted or internally housed servers for web hosting. You should consult with your local IT representatives to see what is available.  You can still make use of the official Georgia Tech website theme and page layout system by installing them from their GitHub repositories.

Installing Drupal to an OIT Web Hosting Account

Installing Drupal to an OIT Web Hosting Account kp37
Drupal Version

The following steps should guide you in getting a Drupal installation set up in an OIT Web Hosting account.

Should I Use Drupal on OIT Web Hosting?

Drupal 10 is now fully supported on OIT Web Hosting.  However, this does not mean that it is the right choice for everyone.  For smaller, simpler sites, a WordPress site on Sites @ Georgia Tech might be a good option to consider.  Please see the OIT FAQ guide, Is Drupal the right choice of CMS for my site?, for further discussion of web hosting options.

Regardless, it is strongly recommended that no new sites be built on Drupal 7, as version 7 is reaching the end of its life on November 28, 2022.  After that date, it will no longer receive any security support from its developers.

A Turnkey Drupal 10 Website on OIT Web Hosting

OIT is now offering an updated version of Drupal Express for Drupal 9 based websites.  When requesting a new Web Hosting account, you can mark this option on the request form and your account will be pre-loaded with a ready-to-use version of Drupal 9 complete with the official Georgia Tech web theme and page layout system.

Other Options for Drupal 10

Before you Begin: If you haven't done so already, you'll need to request a hosting account from OIT.  You will also need to know how to access the Plesk control panel for your account in order to complete the rest of these steps, and you may also wish to set an SSH password or SSH key so that you can SSH into your web hosting space.

If you decided to set up Drupal somewhere else to build your site, and now want to move that site to OIT Web Hosting, you should see our separate Site Migration Guide.

Installing Drupal 10 Using GitHub and Composer

If you prefer to manually install Drupal 8 with the official Georgia Tech components, there is a GT Installer script available to guide you through the process.  Please also see the following OIT FAQ guides:

Installing Drupal 10 Manually From a Downloaded Archive File

Another way to install Drupal is to download the installer and copy it to your hosting account.  Please note that this method is not compatible with the official Georgia Tech web theme, so it is only suitable for sites that do not need this theme (e.g. student organization sites, research project sites, etc.)

  1. Visit the Drupal.org website and download the latest version of the Drupal 9.x series for any site that needs to have standard Georgia Tech branding.
    • Use the latest stable release of Drupal
    • If your are comfortable with using SSH to connect to your Web Hosting account, you can select either download format (.tar.gz or .zip).  If you prefer to upload the archive file to your Web Hosting account via the Plesk control panel, you must download the ZIP format file.
  2. Upload the archive file to your OIT Web Hosting Account and unpack it where you want your Drupal installation to live.  From within the Plesk control panel, you can upload the archive file via the File Manager.  Once the file is uploaded, just select it in the File Manager to unpack it.  After the archive file has been unpacked, move it to your hosting account's "/private/" folder.
  3. In the Plesk control panel, go to the Databases manager and create a new database.  Copy down the database name, the database user name, and the password, as you will need them later.
  4. Navigate to your Web Hosting site's URL and you should get an installation screen for Drupal.  Follow the prompts and answer the questions - they should mostly be straightforward.  Refer to the Drupal Installation Guide if you need any help.

Installing Drupal on Your Own Computer

Installing Drupal on Your Own Computer esembrat3
Drupal Version

Purpose

A development copy of Drupal on your local computer lets you design and build a site with a few fewer hassles.  It is an excellent place to do testing and code development, but does not support collaboration very well.  For collaborating with stakeholders, you may want to have both a development site on your local computer and a test site on a regular internet connected web hosting solution (e.g. OIT Web Hosting or a departmentally run server).

Potential Uses

  • Testing new patches or major upgrades.
  • Testing out new themes or modules.
  • Module or theme development.
  • Stress-testing a site.
  • Getting familiar with Drupal.

Expert Local Development Guides

How to Set Up a Mac OS X / macOS System for Local Development

How to Set Up a Mac OS X / macOS System for Local Development bwaye3
Drupal Version

This process allows you to set up your Mac as a faux-server for local development.

  1. Download Xcode from the App Store:  https://developer.apple.com/xcode/
  2. Install command line tools: http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/
  3. Install and configure wget: http://coolestguidesontheplanet.com/install-and-configure-wget-on-os-x/

Do note that Drupal 8 requires PHP 7, and only MacOS 10.14+ (Mojave or later) come with PHP 7 – all earlier versions have some form of PHP 5.  If you are running and older version of MacOS, you can either use HomeBrew to try to upgrade PHP, or look at one of the options to install a virtual development environment on your local computer.

How to Use Lando as a Drupal Development Environment

How to Use Lando as a Drupal Development Environment
Category
esembrat3
Drupal Version

What is Lando? From the Lando documentation:

It's a free, open source, cross-platform, local development environment and DevOps tool built on Docker container technology and developed by Tandem. Designed to work with most major languages, frameworks and services, Lando provides an easy way for developers of all skill levels to specify simple or complex requirements for their projects, and then quickly get to work on them.

In simpler terms, it is a container system built on Docker that runs on Windows, MacOS, and Linux, letting you spin up development websites with a minimum technical hassles.  It is just one of many ways to easily set up a Drupal 10 development site for either building a complete new website, doing module development work, or testing third-party modules in a safe "sandbox" environment.

Enabling a Mail Server in Lando

Enabling a Mail Server in Lando
Category
esembrat3
Drupal Version

The Lando Drupal 7 recipe does not come with mail functionality out-of-the-box. However, DrupalEasy has written straight-forward documentation on how to enable server mail functionality.

This is helpful for enabling mail notifications for password resets, trigger/Rules configuration.

Process

  1. Add the following configuration to your .lando.yml recipe:
    proxy:
      mailhog:
        - mail.lemp.lndo.site
    services:
      mailhog:
        type: mailhog
        hogfrom:
          - appserver
  2. Edit mail.lemp.lndo.site to better match, mirror, or apply to your local Lando website.

  3. Run "lando rebuild". Caution should be used when using using the 'rebuild' command, as while most services retain their data during a rebuild, some may not

  4. Running "lando start" will now initialize a Mailhog server, which will siphon all Drupal-generated mail into that inbox.

Lando and Mercury Reader

Lando and Mercury Reader
Category
esembrat3
Drupal Version

Mercury Reader requires an extra php extension outside of what lando's drupal10 recipe typically provides.

Process

Adjust your lando.yml Landofile to include the following:

services:  
  appserver:
    build_as_root:
      - apt-get update -y
      - apt-get install libxslt1-dev -y
      - docker-php-ext-install xsl
      - docker-php-ext-enable xsl

Rebuild your lando environment to install the libraries:

lando rebuild -y

 

Set up lando on Windows 10 for an easy local development environment

Set up lando on Windows 10 for an easy local development environment
Category
afrank30
Drupal Version
  1. First install WSL version 2. You do not need VSCode or Hyper-V and may not even need to install a specific version of Ubuntu (20.04 at the time of writing), as it usually defaults to the latest version.
  2. Next, install Docker Desktop for Windows (on Windows, NOT within the Ubuntu VM).
  3. Then, install lando's .exe from github (on Windows, NOT within the Ubuntu VM).

Starting a Drupal 10 Website with Lando

Starting a Drupal 10 Website with Lando
Category
esembrat3
Drupal Version

The below scenario assumes you have Lando installed on your own machine for local development.

Kickstarting a Drupal 9 website

Install Drupal via composer:

composer create-project drupal-composer/drupal-project:10.x-dev SITENAME --no-interaction

Enter SITENAME and init lando.

cd SITENAME
lando init

During the lando init process:

  • Select the appropriate recipe (drupal9) for lando.
  • Provide the webroot directory (web).
  • Provide a shortcut name for the lando app (your choice and preference).

Once completed, now start up your virtual environment with:

lando start

Lando will kickstart the virtual filesystems in your specified root directory and initialize a locally-hosted database and web server (using Docker).

When you see BOOMSHAKALAKA!, Lando has configured all the environment configurations and is ready to party.

Using Drupal 10 with Lando

Using Drupal 10 with Lando
Category
esembrat3
Drupal Version

Drupal Console, Drush and Lando

Lando provides scaffolding for tools like Drupal Console and Drush.

To use these tools within Lando, just pre-empt your command with lando to make sure it's running within the Lando interface.

For example, to install a new module in Drupal 8 using Drupal Console, use:

lando drupal moi module_name

Or, to clear all caches using Drupal Console, use:

lando drupal cc all

Please see the Lando Drupal 8 documentation for a full list of tools.

Example .lando.yml files for different environments

Example .lando.yml files for different environments
Category
afrank30
Drupal Version

Here are some example .lando.yml files (and associated settings.php files for drupal) of commonly-used configurations.

Drupal 7: Single site

Database code in settings.php

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'myd7sitedb',
      'username' => 'database',
      'password' => 'database',
      'host' => 'database',
      'port' => '3306',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

.lando.yml Code

name: myd7site
recipe: drupal7
config:
  php: '7.3'
  composer_version: 2
  via: 'apache:2.4'
  webroot: .
  database: 'mysql:5.7'
  # note this is just for lando/docker as 'global' install--drush is installed via drupal composer for local site use
  drush: ^8
  xdebug: false
services:
  database:
    creds:
      user: database
      password: database
      database: myd7sitedb
  appserver:
    overrides:
      environment:
        DRUSH_OPTIONS_URI: "https://local.myd7site.gatech.edu"
tooling:
  'lint:php:themes':
    service: appserver
    cmd: /app/vendor/bin/phpcs --standard=phpcs-themes.xml
    description: 'Runs php linter against your custom code. Ex: lando lint:php'
proxy:
  appserver:
    - myd7site.lndo.site
    - local.myd7site.gatech.edu //set in local hosts file

Drupal 7: Multi site

Database code in settings.php

$databases = array (
  'default' =>
    array (
      'default' =>
        array (
          'database' => 'database',
          'username' => 'mysql',
          'password' => 'mysql',
          'host' => 'ic',
          'port' => '3306',
          'driver' => 'mysql',
          'prefix' => '',
        ),
    ),
);

.lando.yml Code

name: multid7
recipe: drupal7
config:
  php: '7.3'
  composer_version: 2
  via: 'apache:2.4'
  webroot: .
  database: 'mysql:5.7'
  # note this is just for lando/docker as 'global' install--drush is installed via drupal composer for local site use
  drush: ^8
  xdebug: false
proxy:
  appserver:
    - cse.lndo.site
    - local.cse.gatech.edu //set in local hosts file
    - ic.lndo.site
    - local.ic.gatech.edu //set in local hosts file
    - scs.lndo.site
    - local.scs.gatech.edu //set in local hosts file
services:
  cse:
    type: mysql:5.7
    appserver:
      overrides:
        environment:
          DRUSH_OPTIONS_URI: "https://local.cse.gatech.edu"
  ic:
    type: mysql:5.7
    appserver:
      overrides:
        environment:
          DRUSH_OPTIONS_URI: "https://local.ic.gatech.edu"
  scs:
    type: mysql:5.7
    appserver:
      overrides:
        environment:
          DRUSH_OPTIONS_URI: "https://local.scs.gatech.edu"

Drupal 9: Single site

Database code in settings.php

$databases['default']['default'] = array (
  'database' => 'myd9db',
  'username' => 'database',
  'password' => 'database',
  'prefix' => '',
  'host' => 'database',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

.lando.yml Code

name: myd9
recipe: drupal9
config:
  php: '7.3'
  composer_version: 2
  via: 'apache:2.4'
  webroot: .
  database: 'mysql:5.7'
  drush: true
  xdebug: false
tooling:
  'lint:php:themes':
    service: appserver
    cmd: /app/vendor/bin/phpcs --standard=phpcs-themes.xml
    description: 'Runs php linter against your custom code. Ex: lando lint:php'
  drush:
    service: appserver
    env:
     DRUSH_OPTIONS_URI: "https://local.myd9.gatech.edu"
proxy:
  appserver:
    - myd9.lndo.site
    - local.myd9.gatech.edu // set in local hosts file
services:
  database:
    creds:
      user: database
      password: database
      database: myd9db

Symfony 4

.lando.yml Code

name: samplesymfony4app
recipe: symfony
config:
  symfony: '4'
  php: '7.3'
  via: 'apache:2.4'
  webroot: public
  database: mysql:5.7
  services:
    database:
        creds:
            user: database
            password: database
            database: gradcc

Symfony 5

.lando.yml Code

name: samplesymfony5app
recipe: symfony
config:
  php: '7.3'
  via: 'apache:2.4'
  webroot: public
  database: mysql:5.7
  services:
    database:
        creds:
            user: database
            password: database
            database: symfony5db

Simple LAMP stack for PHP

.lando.yml Code

name: myphp
recipe: lamp
config:
  php: '7.4'
  via: 'apache:2.4'
  composer_version: '2'
  webroot: public
  database: mysql:5.7
  services:
    database:
        creds:
            user: database
            password: database
            database: myphpdb
  proxy:
    appserver:
      - myphp.lndo.site
      - local.myphp.gatech.edu // set in local hosts file

File or Directory Permissions Errors

File or Directory Permissions Errors afrank30
Drupal Version

General Permissions Errors

Note:  If you are running in a shared hosting environment, like OIT Web Hosting, then you are not likely to get many if any general permission errors, as each website runs under its own hosting account in these environments.  Thus, it is nearly impossible to mess up file and directory ownership in these environments.  However, it is worth checking the file and directory permissions, as they are often changeable, and if the owner-write permission is removed from a file or directory then the web server will not be able to modify that file or directory.

If you see any kind of general file or directory permissions errors, the first thing to check is that your sites "sites/default/files" directory and all of its subdirectories are writable by account that your web server runs under.  On stand-alone web servers, these directories and their files don't necessarily have to be owned by this account, but the account still has to have permission to access them.  Consult with your server administrator if you need help in determining the right user and group ownerships for your website's files and directories.

Temporary Directory Permissions Errors

Sometimes after moving a Drupal site to a new web server, you may see an error message that looks something like this:

The specified file temporary://fileX could not be copied, 
because the destination directory is not properly configured. 
This may be caused by a problem with file or directory permissions. 
More information is available in the system log.

Often this is accompanied by the site looking strange and not having much theming or design. This happens because your site's file system needs permissions to access the Temporary directory.  Usually this directory is located at "/tmp", but sometimes the person who built the Drupal site configured it to use a special directory, and then when you copied the site to the new web server, either that special directory was not created or its permissions were not set correctly.

To fix this, try to log into the site as an administrative user and then navigate to the Media section of the Configuration administration page, and go into the File system sub-section.  If you have trouble navigating through the site, you might try going directly to that page:

  http://your-site-host-name/admin/config/media/file-system

On the File system page, make a note of the path set for Temporary directory and then check to make sure it exists on your server and that it is writable by the account that your web server runs under.  Alternatively, you may want to just change the value of Temporary directory to "/tmp" and see if that works.  For websites on OIT Web Hosting, the path "/tmp" should always work, and it's a good starting point for many other web servers out there as well.  If you still run into problems then you may need to contact your server administrator to find out what temporary directory path you should use with Drupal for that server.

Installing Drupal 10 Using the GT Installer Script

Installing Drupal 10 Using the GT Installer Script kp37
Drupal Version

For most general use cases, we recommend the OIT Web Hosting turnkey install option of Drupal 10: when requesting a new Web Hosting account, you can mark the Drupal Express option on the request form and your account will be pre-loaded with a ready-to-use version of Drupal 10 complete with the official Georgia Tech web theme and page layout system.

Some users may wish to manually set up Drupal 10 with Georgia Tech components. A Drupal 10 GT Installer script is available to install Drupal Core, the GT Theme, the GT Tools module, and the Curie profile.

NOTE: If you want to have the Georgia Tech theme blocks for Layout Builder in your site, you should install the site either through the GT Installer script or the turnkey option mentioned above. While not impossible, it is difficult to properly install these components into an already existing Drupal 10 website.

Pre-Installation Note

  • Download the installer script to a directory outside of the project path. Otherwise, you will receive a “$PROJECTPATH is not empty” error.
  • If you have receive a memory limit error, you can set the composer memory limit with the following command:
    • export COMPOSER_MEMORY_LIMIT=-1

Installation process

  1. Download and unzip the gt_installer project.
  2. At the command line, navigate to the gt_installer directory.
  3. Make sure the file 'install.sh' is executable.
  4. Run ./install.sh and follow the prompts:
$ ./install.sh

Enter the full path to your project directory: /c/path/to/your/installation-folder

Enter your database username: database_username

Enter your database password: database_password

Enter your database host (probably localhost): localhost

Enter the database port: 3306

Enter the name of the database: database_name

Enter the site name: Site Name

Enter the site email: email@gatech.edu

Attribution

Instructions courtesy of Veronique Topping.