🚀 Installation Nextcloud 27 unter Ubuntu 22.04 – Schritt für Schritt


🔍 Offizielle Systemanforderungen (Nextcloud 27)

📦 Server-Komponenten

KomponenteMindestanforderungEmpfohlen für Produktivumgebungen
PHP8.1.0+ (8.2/8.3 empfohlen)OPcache, JIT aktiviert
DatenbankMariaDB 10.6+
MySQL 8.0+
PostgreSQL 13+
MariaDB 10.11+ mit InnoDB
Speicher512MB RAM4GB+ RAM + Redis/Memcached
WebserverApache 2.4+
nginx 1.18+
Apache mit mod_php und mpm_event

📌 Zwingend benötigte PHP-Module

apt install php8.2-{bcmath,bz2,curl,gd,gmp,intl,imagick,ldap,mbstring,mysql,redis,smbclient,zip,xml,opcache,cli,common,apcu}

🔧 Kritische PHP-Einstellungen

memory_limit = 512M
upload_max_filesize = 16G
post_max_size = 16G
opcache.enable=1
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000

🛠️ Enterprise-Grade Installation

1️⃣. Systemvorbereitung

sudo apt update && sudo apt full-upgrade -y
sudo apt install -y software-properties-common apt-transport-https ca-certificates

2️⃣. PHP 8.3 Repository hinzufügen

sudo LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
sudo apt update

3️⃣. Komponenten installieren (Production-Stack)

sudo apt install -y \
apache2 mariadb-server \
php8.3 php8.3-{bcmath,bz2,curl,gd,gmp,intl,imagick,ldap,mbstring,mysql,redis,smbclient,zip,xml,opcache,cli,fpm,common,apcu} \
libapache2-mod-php8.3 redis-server libmagickcore-6.q16-6-extra

4️⃣. MariaDB-Tuning (my.cnf)

[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
transaction-isolation = READ-COMMITTED
innodb_flush_log_at_trx_commit = 2
innodb_log_file_size = 512M
innodb_buffer_pool_size = 2G

5️⃣. Datenbank optimiert erstellen

CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nc_user'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_user'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

6️⃣. Nextcloud Download mit Integritätsprüfung

wget https://download.nextcloud.com/server/releases/latest.tar.bz2{,.sha512}
sha512sum -c latest.tar.bz2.sha512
tar -xjf latest.tar.bz2 --strip-components=1 -C /var/www/nextcloud

7️⃣. Sicherheitshärtung

sudo chown -R www-data:www-data /var/www/nextcloud
sudo find /var/www/nextcloud/ -type d -exec chmod 750 {} \;
sudo find /var/www/nextcloud/ -type f -exec chmod 640 {} \;
sudo setfacl -R -m u:www-data:rwx /var/www/nextcloud/apps/

8️⃣. Apache Virtual Host (SSL-Vorbereitung)

<VirtualHost *:80>
    ServerName cloud.your-domain.com
    Redirect permanent / https://cloud.your-domain.com/
</VirtualHost>

<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile      /etc/letsencrypt/live/cloud.your-domain.com/fullchain.pem
    SSLCertificateKeyFile   /etc/letsencrypt/live/cloud.your-domain.com/privkey.pem
    
    DocumentRoot /var/www/nextcloud
    <Directory /var/www/nextcloud>
        Require all granted
        Options FollowSymlinks
        AllowOverride All
    </Directory>

    Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set Permissions-Policy "interest-cohort=()"
</VirtualHost>

🔐 Post-Installations-Checkliste

  1. Let’s Encrypt SSL-ZertifikatbashCopysudo apt install certbot python3-certbot-apache sudo certbot –apache -d cloud.your-domain.com
  2. Redis-Konfiguration für CachingphpCopy’memcache.local‘ => ‚\OC\Memcache\Redis‘, ‚redis‘ => [ ‚host‘ => ‚localhost‘, ‚port‘ => 6379, ],
  3. Cron-Job für HintergrundtasksbashCopysudo -u www-data php /var/www/nextcloud/occ background:cron
  4. Security & Hardening ScanbashCopysudo -u www-data php /var/www/nextcloud/occ check sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess

📈 Monitoring & Wartung

# Nextcloud Status Monitoring
sudo -u www-data php /var/www/nextcloud/occ status

# Log-Analyse
journalctl -u apache2 -f -n 100
tail -f /var/www/nextcloud/data/nextcloud.log

# Automatische Updates
sudo -u www-data php /var/www/nextcloud/occ upgrade
sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on

Enterprise-Tipp: Für HA-Umgebungen kombinieren Sie mit Galera Cluster für MariaDB, GlusterFS für Storage und Varnish Cache um die Geschwindigkeit bei Apache zu beschleunigen. Weiterhin lässt sich die Cloud sehr gut in einer Docker Standalone/Swarm oder k8s Umgebung betreiben.

🔗 Offizielle Nextcloud Production Docs:
https://docs.nextcloud.com/server/latest/admin_manual/installation/


Lassen Sie uns in den Kommentaren über Ihre Skalierungsstrategien diskutieren! 🚀

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert