1) Voraussetzungen & Grundsetup

  • Raspberry Pi OS Lite (64-bit) mit Raspberry Pi Imager auf die SSD flashen (bei Bedarf „Alle Laufwerke anzeigen“).
  • USB-Bootloader ggf. via Imager → Misc utility images → Bootloader (USB Boot) auf microSD, einmalig booten, dann microSD entfernen.
  • Im Imager Optionen setzen: Hostname core.local, User master, SSH aktiv, Locale/Zeitzone DE/Berlin.
ssh master@core.local
hostnamectl
lsblk -o NAME,MODEL,SIZE,MOUNTPOINTS,UUID

Basis-Ordner anlegen (wenn nicht schon vorhanden):

sudo mkdir -p /srv/{dokuwiki,shares,services}
sudo groupadd -f wikidev
sudo chgrp -R wikidev /srv
sudo chmod -R 2775 /srv

2) Pi-hole installieren (Web-Port 8081)

Pi-hole nutzt Port 53 (DNS) und lighttpd auf Port 80. Da Apache später Port 80 belegt, legen wir das Admin-Panel auf 8081.

curl -sSL https://install.pi-hole.net | bash
# Assistent: Interface (z. B. eth0), Upstream-DNS (1.1.1.1/9.9.9.9), Listen & Privacy nach Wunsch
sudo sed -i 's/^server.port.*/server.port = 8081/' /etc/lighttpd/lighttpd.conf || echo 'server.port = 8081' | sudo tee -a /etc/lighttpd/lighttpd.conf
sudo systemctl restart lighttpd

Router-DNS auf die Pi-IP setzen. Admin-Panel: http://core.local:8081/admin

pihole -a -p     # Admin-Passwort setzen
pihole -g        # Adlists neu laden
pihole -q heise.de  # Query prüfen

3) DokuWiki auf Apache 2 + PHP-FPM

DokuWiki benötigt keine Datenbank. Wir betreiben es auf Apache 2 mit PHP-FPM.

sudo apt-get update
sudo apt-get install -y apache2 php-fpm php-xml php-gd php-json php-mbstring php-cli php-intl php-curl php-zip unzip curl
sudo a2enmod proxy proxy_fcgi setenvif rewrite headers deflate env mime dir

cd /srv
curl -L -o dokuwiki.tgz https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
tar -xzf dokuwiki.tgz && mv dokuwiki-*/ dokuwiki && rm dokuwiki.tgz
sudo chown -R $USER:wikidev /srv/dokuwiki && sudo chmod -R 2775 /srv/dokuwiki

PHP_SOCK=$(ls /run/php/php*-fpm.sock | head -n1)
sudo tee /etc/apache2/sites-available/dokuwiki.conf >/dev/null <<EOF
<VirtualHost *:80>
  ServerName core.local
  DocumentRoot /srv/dokuwiki
  DirectoryIndex doku.php index.php index.html
  <Directory /srv/dokuwiki> Options +FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
  <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^_media/(.*) /lib/exe/fetch.php?media=$1 [QSA,L]
    RewriteRule ^_detail/(.*) /lib/exe/detail.php?media=$1 [QSA,L]
    RewriteRule ^_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 [QSA,L]
    RewriteRule ^$ doku.php [L]
    RewriteRule (.*) doku.php?id=$1 [QSA,L]
  </IfModule>
  <FilesMatch "\.php$"> SetHandler "proxy:unix:${PHP_SOCK}|fcgi://localhost/" </FilesMatch>
  <Directory ~ "/(data|conf|bin|inc)/"> Require all denied </Directory>
  ErrorLog  ${APACHE_LOG_DIR}/dokuwiki_error.log
  CustomLog ${APACHE_LOG_DIR}/dokuwiki_access.log combined
</VirtualHost>
EOF
sudo a2dissite 000-default.conf
sudo a2ensite dokuwiki.conf
sudo apache2ctl configtest && sudo systemctl reload apache2

Erstkonfiguration im Browser: http://core.local/ → Setup.

4) Samba-Freigaben für /srv

sudo apt-get install -y samba
sudo systemctl enable --now smbd nmbd

sudo mkdir -p /srv/shares/public
sudo chgrp -R wikidev /srv/shares && sudo chmod -R 2775 /srv/shares

sudo tee -a /etc/samba/smb.conf >/dev/null <<'CONF'
[public]
  path = /srv/shares/public
  browseable = yes
  read only = no
  guest ok = yes
  force group = wikidev
  create mask = 0664
  directory mask = 2775
CONF
sudo systemctl restart smbd
testparm

Zugriff (Clients):

Windows: \\core.local\public
macOS:   smb://core.local/public
Linux:   Dateimanager → „Mit Server verbinden…“

5) Rechte & Struktur (Gruppen-Strategie)

Ziel: Schreibrechte für Team-Gruppe wikidev ohne dauerndes chmod. setgid vererbt die Gruppe.

sudo groupadd -f wikidev
sudo usermod -aG wikidev master
sudo chgrp -R wikidev /srv
sudo find /srv -type d -exec chmod 2775 {} \;
sudo find /srv -type f -exec chmod 0664 {} \;

Optional ACL (falls benötigt): setfacl -R -m d:g:wikidev:rwx,g:wikidev:rwx /srv

6) SMB.conf & /etc/fstab – Builder

Nutze die grafischen Builder, um **fehlerfreie** Snippets zu erzeugen:

Hinweis Windows-UNC in DokuWiki/Markdown: Backslashes in Monospace/Code setzen, z. B. \\core.local\public.

7) Backup & Cron (Builder)

Erzeuge Skript + Crondatei mit dem **Backup & Cron Builder**. Features: Platz-Check, Mehrfach-Ziele, Retention, Excludes, Logs.

Backup & Cron Builder öffnen

Beispiel-Skript

/usr/local/bin/backup-dokuwiki.sh
# erstellt tar.gz unter /mnt/backup*/dokuwiki-backup/ mit 7-Tage-Retention

Cron (täglich 03:15)

15 3 * * * root /usr/local/bin/backup-dokuwiki.sh >> /dev/null 2>&1
# /etc/cron.d/backup

8) systemd-Services (Builder)

Erzeuge Services für Self-Hosted-Apps (WorkingDirectory, Environment, Restart-Policy etc.).

systemd Service Builder öffnen

Check

sudo systemctl daemon-reload
sudo systemctl enable --now meinservice
systemctl status meinservice

9) Apache Reverse-Proxy (Builder)

Für Dienste hinter Apache (inkl. WebSockets, Security-Header, SSL-Platzhalter):

Apache Reverse-Proxy Builder öffnen
sudo a2enmod proxy proxy_http proxy_wstunnel headers ssl
sudo apache2ctl configtest && sudo systemctl reload apache2

10) Troubleshooting & Checks

  • Pi-hole Admin-Panel down: systemctl status lighttpd · Port in lighttpd.conf auf 8081 gesetzt?
  • DokuWiki lädt nicht: systemctl status apache2 php*-fpm · a2ensite dokuwiki.conf · Logs: /var/log/apache2/.
  • Samba verweigert: testparm · Pfade/Masken prüfen · für geschützte Shares smbpasswd -a <user>.
  • Host nicht per Name: Router-DNS auf Pi-hole stellen oder per IP testen.
  • Rechte-Chaos: Gruppe wikidev korrekt? setgid 2775 auf Ordnern, 0664 auf Dateien.

Schnell-Checks

curl -I http://core.local/
getent hosts core.local
smbclient -L //core.local -N
df -h /mnt/backup1
sudo journalctl -u apache2 -u smbd -u php*-fpm --no-pager -n 100

Downloads

Tipp: Handbuch als PDF drucken – im Browser „Als PDF speichern“.