Drupal

Drupal is a free, web-based Open Source Content Management System (CMS) and Framework written in PHP and distributed under the GPL 2.0 (or later) licence.

According to W3Techs (2011-07-15), at least 2.3% of all websites worldwide are running with Drupal.

Drupal 8 is based on Symfony, a popular high performance PHP framework for web development.

Drupal was released for the first time in 2000 by Dries Buytaert. Since then it has been continuously developed and it is actively maintained by various contributors.


Note

You should be familiar with the basic concepts of

Prerequisites

PHP 7.2

We are using PHP in the stable version 7.2:

[isabell@stardust ~]$ uberspace tools version show php
Using 'PHP' version: '7.2'
[isabell@stardust ~]$

Database credentials

You’ll need your MySQL credentials. Get them with my_print_defaults:

[isabell@stardust ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=isabell
--password=MySuperSecretPassword
[isabell@stardust ~]$

Domain

Your website domain needs to be set up:

[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$

Database

It’s recommended to create an additional database, for example: isabell_drupal.

Installation via Composer

cd into the directory above your document root /var/www/virtual/$USER/ and run composer:

[isabell@stardust ~]$ cd /var/www/virtual/$USER/
[isabell@stardust isabell]$ composer create-project drupal/recommended-project drupal
Installing drupal/recommended-project (8.8.4)
  - Installing drupal/recommended-project (8.8.4): Downloading (100%)
Created project in drupal
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 56 installs, 0 updates, 0 removals
  - Installing drupal/core-composer-scaffold (8.8.4): Downloading (connecting...Downloading (100%)
  - Installing drupal/core-project-message (8.8.4): Downloading (100%)
[...]

  Congratulations, you’ve installed the Drupal codebase
  from the drupal/recommended-project template!


Next steps:
  * Install the site: https://www.drupal.org/docs/8/install
  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html
  * Get support: https://www.drupal.org/support
  * Get involved with the Drupal community:
      https://www.drupal.org/getting-involved
  * Remove the plugin that prints this message:
      composer remove drupal/core-project-message
  * Homepage: https://www.drupal.org/project/drupal
  * Support:
    * docs: https://www.drupal.org/docs/user_guide/en/index.html
    * chat: https://www.drupal.org/node/314178
[isabell@stardust isabell]$

Installation

Open a browser and visit the URL of your domain. It’s self-explanatory, for specific steps and screenshots checkout Running the Interactive Installer.

Configuration

Trusted Host setting

For Drupals protection against HTTP HOST Header attacks, you need to configure Trusted host security setting in settings.php, which was introduced in Drupal 8.

Add the following configuration to the settings.php file.

$settings['trusted_host_patterns'] = [
  '^isabell\.uber\.space$',
];

Cronjob

For executing periodical tasks like updating the search index, purging old logs or checking for updates, etc. you will need to set up a cronjob.

Get your cron URL for your site under Administration → Configuration → System → Cron. We create a cronjob which runs every hour.

Add the following cronjob to your crontab:

0 * * * * wget -O - -q -t 1 https://isabell.uber.space/cron/CsUKMfKtaFI8P3CaFpWy6iMIJPjjAwnm-Svs6wXb_LSrxqLnlbv85qy5us0YSnK3iQpthKoIrQ

Updates

Hint

Configure update notifications under AdministrationReportsAvailable updatesSettings and subscribe to Security advisories and public service announcements too!

Core Updates

Note

Also see section 13.5. Updating the Core Software of the Drupal User Guide and the article Update core via Composer for up-to-date instructions.

Step 1: Allow access to update.php

Open /var/www/virtual/$USER/drupal/sites/default/settings.php, find the line with the $settings['update_free_access'] variable and set it to TRUE.

Step 2: Enable maintenance mode

In the Manage administrative menu, navigate to ConfigurationDevelopmentMaintenance mode, enable the Put site into maintenance mode option and click on Save configuration.

Step 3: Update via Composer

Update the Drupal Core packages with Composer:

[isabell@stardust isabell]$ cd /var/www/virtual/$USER/drupal
[isabell@stardust drupal]$ composer update drupal/core --with-dependencies
[isabell@stardust drupal]$

Step 4: Run update.php

Visit https://isabel.uber.space/update.php and click Continue to run the update.

Step 5: Deny access to update.php

Open /var/www/virtual/$USER/drupal/sites/default/settings.php, find the line with the $settings['update_free_access'] variable and set it to FALSE.

Step 6: Disable maintenance mode

In the Manage administrative menu, navigate to ConfigurationDevelopmentMaintenance mode, disable the Put site into maintenance mode option and click on Save configuration.

Step 7: Clear caches

In the Manage administrative menu, navigate to ConfigurationDevelopmentPerformance and click Clear all caches.


Tested with Drupal 8.8.4 and Uberspace 7.5.0.0

Written by: Florian Latzel <https://netzaffe.de>, Yannick Ihmels <yannick@ihmels.org>