Nextcloud Installation: Self-Hosted Cloud-Speicher und Zusammenarbeit
Nextcloud-Installation mit Docker, Apache/Nginx-Konfiguration, Datenbankeinrichtung, SSL-Zertifikat, Dateisynchronisierung, App-Store und Leistungsoptimierung.
Inhaltsverzeichnis
Nextcloud Installation: Self-Hosted Cloud-Speicher und Zusammenarbeit
Nextcloud ist eine Open-Source, Self-Hosted Alternative zu Cloud-Speicherdiensten wie Google Drive, Dropbox und OneDrive. Neben Dateispeicherung und -synchronisierung bietet es Kalender, Kontakte, Videokonferenzen, Dokumentenbearbeitung und vieles mehr. Diese Anleitung behandelt die Nextcloud-Installation mit Docker Compose, Nginx Reverse Proxy-Konfiguration und Leistungsoptimierung.
Was ist Nextcloud?
Nextcloud ist eine Kollaborationsplattform, die Ihnen die vollständige Kontrolle über Ihre Daten gibt:
- Dateispeicherung: Unbegrenzter Speicher (begrenzt nur durch Ihre Festplattenkapazität)
- Synchronisierung: Windows, macOS, Linux, iOS, Android-Clients
- App-Store: 200+ Apps (Nextcloud Talk, Calendar, Contacts, Office)
- Benutzerverwaltung: LDAP/AD-Integration, Gruppenverwaltung
- Sicherheit: Ende-zu-Ende-Verschlüsselung, 2FA, Audit-Log
Systemanforderungen
- Ubuntu 22.04 oder Debian 12
- Mindestens 2 GB RAM (4 GB empfohlen)
- Mindestens 20 GB Festplatte (zusätzlicher Speicherplatz)
- Docker und Docker Compose installiert
Installation mit Docker Compose
Verzeichnisstruktur erstellen
mkdir -p /opt/nextcloud/{data,db,redis}
cd /opt/nextcloud
docker-compose.yml Datei
version: '3.8'
services:
db:
image: postgres:16-alpine
container_name: nextcloud-db
restart: unless-stopped
environment:
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: starkes-db-passwort
volumes:
- ./db:/var/lib/postgresql/data
networks:
- nextcloud-net
redis:
image: redis:7-alpine
container_name: nextcloud-redis
restart: unless-stopped
command: redis-server --requirepass redis-passwort
volumes:
- ./redis:/data
networks:
- nextcloud-net
app:
image: nextcloud:28-fpm-alpine
container_name: nextcloud-app
restart: unless-stopped
depends_on:
- db
- redis
environment:
POSTGRES_HOST: db
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: starkes-db-passwort
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin-passwort
NEXTCLOUD_TRUSTED_DOMAINS: cloud.example.com
REDIS_HOST: redis
REDIS_HOST_PASSWORD: redis-passwort
PHP_MEMORY_LIMIT: 512M
PHP_UPLOAD_LIMIT: 10G
volumes:
- ./data:/var/www/html
networks:
- nextcloud-net
nginx:
image: nginx:alpine
container_name: nextcloud-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./data:/var/www/html:ro
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/ssl/nextcloud:ro
depends_on:
- app
networks:
- nextcloud-net
cron:
image: nextcloud:28-fpm-alpine
container_name: nextcloud-cron
restart: unless-stopped
volumes:
- ./data:/var/www/html
entrypoint: /cron.sh
depends_on:
- db
- redis
networks:
- nextcloud-net
networks:
nextcloud-net:
driver: bridge
SSL-Zertifikat
# Let's Encrypt-Zertifikat mit Certbot
apt install certbot -y
certbot certonly --standalone -d cloud.example.com
# Zertifikate kopieren
mkdir -p /opt/nextcloud/ssl
cp /etc/letsencrypt/live/cloud.example.com/fullchain.pem /opt/nextcloud/ssl/
cp /etc/letsencrypt/live/cloud.example.com/privkey.pem /opt/nextcloud/ssl/
# Automatische Erneuerung per Cron
echo "0 3 * * * certbot renew --quiet && cp /etc/letsencrypt/live/cloud.example.com/*.pem /opt/nextcloud/ssl/ && docker restart nextcloud-nginx" | crontab -
Nextcloud starten
cd /opt/nextcloud
docker compose up -d
# Logs verfolgen
docker compose logs -f app
# Nach der Installation zugreifen:
# https://cloud.example.com
occ-Befehle
Nextcloud mit dem occ-Befehlszeilentool verwalten:
# occ-Befehl ausführen
docker exec -u www-data nextcloud-app php occ [befehl]
# Systemstatus prüfen
docker exec -u www-data nextcloud-app php occ status
# Wartungsmodus umschalten
docker exec -u www-data nextcloud-app php occ maintenance:mode --on
docker exec -u www-data nextcloud-app php occ maintenance:mode --off
# Fehlende Indizes hinzufügen
docker exec -u www-data nextcloud-app php occ db:add-missing-indices
# Dateien scannen (neue Dateien erkennen)
docker exec -u www-data nextcloud-app php occ files:scan --all
# Cache leeren
docker exec -u www-data nextcloud-app php occ cache:clear
# Benutzer auflisten
docker exec -u www-data nextcloud-app php occ user:list
App-Installation
# Verfügbare Apps auflisten
docker exec -u www-data nextcloud-app php occ app:list
# Apps installieren
docker exec -u www-data nextcloud-app php occ app:install calendar
docker exec -u www-data nextcloud-app php occ app:install contacts
docker exec -u www-data nextcloud-app php occ app:install talk
docker exec -u www-data nextcloud-app php occ app:install onlyoffice
Leistungsoptimierung
Redis-Caching
Redis ist bereits in docker-compose.yml konfiguriert. Zur Nextcloud-Konfiguration hinzufügen:
docker exec -u www-data nextcloud-app php occ config:system:set redis host --value="redis"
docker exec -u www-data nextcloud-app php occ config:system:set redis port --value=6379 --type=integer
docker exec -u www-data nextcloud-app php occ config:system:set redis password --value="redis-passwort"
docker exec -u www-data nextcloud-app php occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu"
docker exec -u www-data nextcloud-app php occ config:system:set memcache.distributed --value="\\OC\\Memcache\\Redis"
docker exec -u www-data nextcloud-app php occ config:system:set memcache.locking --value="\\OC\\Memcache\\Redis"
Sicherheitseinstellungen
# Vertrauenswürdige Domain hinzufügen
docker exec -u www-data nextcloud-app php occ config:system:set trusted_domains 1 --value="cloud.example.com"
# Brute-Force-Schutz
docker exec -u www-data nextcloud-app php occ config:system:set auth.bruteforce.protection.enabled --value=true --type=boolean
# 2FA erzwingen
docker exec -u www-data nextcloud-app php occ twofactorauth:enforce --on
Wir empfehlen die Verwendung von SSD-Speicher für Nextcloud auf REXE-Servern. NVMe SSD-Leistung macht bei großen Dateiübertragungen einen entscheidenden Unterschied.
Verwandte Artikel
Coolify Installation: Anwendungs-Deployment mit Self-Hosted PaaS
Coolify-Installation, Docker- und Git-Integration, Anwendungs-Deployment, Datenbankverwaltung, SSL-Zertifikate, Umgebungsvariablen und Self-Hosted PaaS als Alternative zu Heroku/Netlify.
Docker-Verwaltung mit Portainer: Webbasierte Container-Kontrolle
Portainer CE Installation, Docker- und Kubernetes-Verwaltung, Stack-Deployment, Volume/Netzwerk-Verwaltung, Benutzerautorisierung, Webhook und GitOps-Integration.
Uptime Kuma Installation: Self-Hosted Uptime-Monitoring
Uptime Kuma Installation mit Docker, HTTP/TCP/DNS/Ping-Monitoring, Benachrichtigungsintegrationen (Telegram, Discord, E-Mail), Status-Page-Erstellung und Alert-Konfiguration.