Einrichtung des Drupal Content Management Systems.
Bezieht sich auf Drupal 8.
Inhalt
Installation
Doku:
https://www.drupal.org/documentation
Vorbereitung
Doku:
PHP
PHP 7.3 für Apache2 installieren (und aktivieren), falls noch eine ältere Version läuft.
Optional: Memory Limit einstellen in /etc/php/7.3/apache2/php.ini
# grep memory_limit /etc/php/7.3/apache2/php.ini
memory_limit = 256M
Der Standardwert war 128M
PHP-Abhängigkeiten
Kurzversion: Alle Pakete auf einmal:
apt-get install composer php7.3-xml php-gd
Composer
Composer ist ein Paket- und Abhängigkeitsmanager für PHP.
Installation (unter Debian), falls noch nicht vorhanden:
apt-get install composer
PHP-DOM
apt-get install php7.3-xml
Bildverarbeitung
apt-get install php-gd
Datenbank-Server
Drupal benötigt einen Datenbank-Server wie MySQL oder PostgreSQL
Drupal-Instanzen einrichten
Info: Es gibt auch eine Multisite-Option.
Doku:
https://www.drupal.org/docs/multisite-drupal
Datenbank
Eine Datenbank mit dazugehörigem Benutzer erzeugen:
Siehe:
https://www.drupal.org/docs/installing-drupal/step-3-create-a-database
Dieses Skript vereinfacht die Angelegenheit:
#!/bin/bash
ADMINPASS="123"
DB_CHARSET="utf8mb4"
DB_COLLATE="utf8mb4_unicode_ci"
if [ "$#" -ne 3 ]; then
echo "Bitte 3 Argumente angeben:"
echo "$0 <DB_NAME> <USERNAME> <PASS>"
exit 1
fi
DB_NAME="$1"
USERNAME="$2"
USERPASS="$3"
(
echo 'create DATABASE `'"$DB_NAME"'` CHARACTER SET '"$DB_CHARSET"' COLLATE '"$DB_COLLATE"';\
create user `'"$USERNAME"'`@`localhost` identified by '"'$USERPASS'"';\
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON '"$DB_NAME"'.* TO `'"$USERNAME"'`@`localhost`;\
FLUSH PRIVILEGES;'
) \
| mysql "$DB" --password="$ADMINPASS"
# EC = ExitCode
EC="$?"
if [ "$EC" -ne 0 ]; then
echo "Fehler. Code: $EC"
else
echo "Fertig."
fi
Drupal-Dateien
Zur Installation wird composer verwendet.
Doku:
https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#download-core
# mkdir /var/www/drupal8
# cd /var/www/drupal8
# chown www-data:www-data .
# su -s /bin/bash www-data
$ MY_SITE_NAME_DIR="name_der_webseite"
$ composer create-project drupal/recommended-project:8.9 $MY_SITE_NAME_DIR
Dabei MY_SITE_NAME_DIR mit dem Namen der Webseite ersetzen
Apache Konfiguration
Siehe:
https://www.drupal.org/docs/system-requirements/web-server
Hier der wesentliche Teil:
# Drupal 8 configuration
DocumentRoot /var/www/drupal8/sitename/web
<Directory /var/www/drupal8/sitename/web>
Options None
Options +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Danach die Konfiguration des Apache neu einlesen ...
systemctl reload apache2
... und die Webseite öffnen, um mittels Web-Schnittstelle die Installation abzuschließen.
Alternative: Abschluss der Installation mit drush an der Kommandozeile vornehmen.
Doku:
https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#download-core
Siehe auch