Nextcloud: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 1: Zeile 1:
==Download==
+
=Nextcloud Installation (Debian 13)=
*um zu starten wechseln wir ins Verzeichnis '''/tmp'''
 
  
*dann nutzen wir "curl" um Nextcloud downzuloaden (Stand Ubuntu 16.04.3)
+
==System vorbereiten==
<pre>
+
*apt update
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
+
*apt install apache2 mariadb-server php php-gd php-curl php-zip php-mysql php-xml php-mbstring php-intl php-bcmath php-gmp php-imagick php-cli libapache2-mod-php unzip wget -y
</pre>
+
 
 +
==Apache Module aktivieren==
 +
*a2enmod rewrite headers env dir mime
 +
*systemctl restart apache2
 +
 
 +
==Datenbank erstellen==
 +
*mysql -u root
  
==Installation==
 
*Zunächst wird nextcloud auf dem Server installiert, dazu entpacken wir die Datei in das Verzeichnis '''/var/www'''
 
 
<pre>
 
<pre>
unzip nextcloud-13.0.1.zip && mv nextcloud /var/www/
+
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
</pre>
 
*Danach erstellen wir für Nextcloud ein Script, dass wir mit dem nano editor erstellen
 
<pre>
 
vi /tmp/nextcloud.sh
 
</pre>
 
<pre>
 
#!/bin/bash
 
ocpath='/var/www/nextcloud'
 
htuser='www-data'
 
htgroup='www-data'
 
rootuser='root'
 
  
printf "Creating possible missing Directories\n"
+
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'secret';
mkdir -p $ocpath/data
 
mkdir -p $ocpath/assets
 
mkdir -p $ocpath/updater
 
  
printf "chmod Files and Directories\n"
+
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
 
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
 
chmod 755 ${ocpath}
 
  
printf "chown Directories\n"
+
FLUSH PRIVILEGES;
chown -R ${rootuser}:${htgroup} ${ocpath}/
 
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
 
chown -R ${htuser}:${htgroup} ${ocpath}/assets/
 
chown -R ${htuser}:${htgroup} ${ocpath}/config/
 
chown -R ${htuser}:${htgroup} ${ocpath}/data/
 
chown -R ${htuser}:${htgroup} ${ocpath}/themes/
 
chown -R ${htuser}:${htgroup} ${ocpath}/updater/
 
  
chmod +x ${ocpath}/occ
+
EXIT;
 
 
printf "chmod/chown .htaccess\n"
 
if [ -f ${ocpath}/.htaccess ]
 
then
 
  chmod 0644 ${ocpath}/.htaccess
 
  chown ${rootuser}:${htgroup} ${ocpath}/.htaccess
 
fi
 
if [ -f ${ocpath}/data/.htaccess ]
 
then
 
  chmod 0644 ${ocpath}/data/.htaccess
 
  chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess
 
fi
 
</pre>
 
*Nun starten wir das Skript mit dem bash befehl:
 
<pre>
 
root@nextcloud:/tmp# sudo bash /tmp/nextcloud.sh
 
Creating possible missing Directories
 
chmod Files and Directories
 
chown Directories
 
chmod/chown .htaccess
 
</pre>
 
*Als nächstes installieren wir apache2
 
<pre>
 
apt-get install apache2
 
</pre>
 
*Danach öffnen wir wieder ein nano script im Verzeichnis '''/etc/apache2/sites-available/''' und nennen es '''nextcloud.conf'''
 
<pre>
 
vi /etc/apache2/sites-available/nextcloud.conf
 
 
</pre>
 
</pre>
<pre>
 
Alias /nextcloud "/var/www/nextcloud/"
 
  
<Directory /var/www/nextcloud/>
+
==Nextcloud herunterladen==
    Options +FollowSymlinks
+
*cd /tmp
    AllowOverride All
+
*wget https://download.nextcloud.com/server/releases/latest.tar.bz2
 +
*tar -xjf latest.tar.bz2
 +
*mv nextcloud /var/www/
  
    <IfModule mod_dav.c>
+
==Rechte setzen==
        Dav off
+
*chown -R www-data:www-data /var/www/nextcloud
    </IfModule>
+
*chmod -R 750 /var/www/nextcloud
  
    SetEnv HOME /var/www/nextcloud
+
==Apache VirtualHost erstellen==
    SetEnv HTTP_HOME /var/www/nextcloud
+
*vi /etc/apache2/sites-available/nextcloud.conf
  
</Directory>
 
</pre>
 
*Um die Seite von available zu enabled zu ändern nutzen wir den befehl
 
 
<pre>
 
<pre>
root@nextcloud:/etc/apache2/sites-available# sudo a2ensite nextcloud
+
<VirtualHost *:80>
Enabling site nextcloud.
 
</pre>
 
*Zusätzlich, zum Aktivieren der Website, verwenden wir den Befehl a2enmod, um das mod_rewrite Apache-Modul zu aktivieren
 
<pre>
 
root@nextcloud:/etc/apache2/sites-available# sudo a2enmod rewrite
 
Enabling module rewrite.
 
</pre>
 
*Zuletzt, bevor wir Apache neu starten, installieren wir noch notwendige module
 
<pre>
 
apt-get update
 
apt-get install libxml2-dev php php-gettext php-pear php-dompdf php-apcu php-imagick
 
apt-get install  php7.2-fpm php7.2-gd php7.2-mysql php7.2-curl php7.2-xml php7.2-zip php7.2-bz2 php7.2-intl php7.2-mcrypt php7.2-mbstring php7.2-json php7.2-xsl php7.2-bcmath php7.2-cgi php7.2-cli php7.2-common  php7.2-imap php-ldap
 
  
 +
ServerName cloud.local
 +
DocumentRoot /var/www/nextcloud
  
</pre>
+
<Directory /var/www/nextcloud/>
*Jetzt können wir Apache neu starten
+
Require all granted
<pre>
+
AllowOverride All
systemctl restart apache2.service
+
Options FollowSymLinks MultiViews
</pre>
+
</Directory>
  
==MySQL Datenbank erstellen==
+
</VirtualHost>
*Installieren mit
 
<pre>
 
apt-get install mysql-server
 
</pre>
 
*Nun loggen wir uns mit dem root Passwort ein
 
<pre>
 
mysql -u root -p
 
</pre>
 
*und erstellen eine Datenbank für Nextcloud
 
<pre>
 
CREATE DATABASE nextcloud;
 
</pre>
 
*dazu erstellen wir noch einen separaten user
 
<pre>
 
GRANT ALL ON nextcloud.* to 'nextcloud'@'localhost' IDENTIFIED BY 'set_database_password';
 
</pre>
 
*um sicherzustellen, dass die laufende Instanz von MySQL über die aktuelle Privileg-Zuweisung weiß, führen wir den folgenden Befehl aus
 
<pre>
 
FLUSH PRIVILEGES;
 
</pre>
 
*Jetzt können wir MySQL verlassen
 
==MySQL Konfigurieren==
 
*Als letztes muss Nextcloud noch konfiguriert werden. Dazu greifen wir über das Webinterface zu
 
<pre>
 
https://server_domain_oder_IP/nextcloud
 
 
</pre>
 
</pre>
  
[[Datei:nc.png|1000px]]
+
==Website aktivieren==
 +
*a2ensite nextcloud.conf
 +
*systemctl reload apache2
  
==LDAP anbinden==
+
==Nextcloud Installation im Browser starten==
*Zu erst LDAP aktivieren, dazu gehen wir auf Apps und dann auf Deinstallierte Apps, dort müsste "LDAP user and group backend" stehen und dann einfach auf aktivieren gehen
+
*http://SERVER-IP
*Wenn das getan ist gehen wir auf Einstellungen und dann auf '''LDAP/AD-Integration'''
 
===Server===
 
Bei '''Server''' tragen wir den gewünschten LDAP-Server ein
 
[[Datei:nextcloudldap1.jpg]]
 
  
===Benutzer===
+
==Cronjob einrichten==
*Bei '''Benutzer''' wählen wir welche Objektklasse wir auswählen wollen und in welcher LDAP-Gruppe gesucht werden soll
+
*crontab -u www-data -e
[[Datei:nextcloudldap2.jpg]]
 
===Anmeldeattribute===
 
*Bei '''Anmeldeattribute''' wählen wir aus mit welchen Attributen Nextcloud den Benutzer finden soll
 
[[Datei:nextcloudldap3.jpg]]
 
===Gruppen===
 
*Bei '''Gruppen''' wählen wir aus welche Gruppen Verfügbar sind, die auf diese Kriterien zutreffen
 
[[Datei:nextcloudldap4.jpg]]
 
==Kalendar==
 
  
==Database lock==
+
<pre>
*mysql -u root -p
+
*/5 * * * * php -f /var/www/nextcloud/cron.php
use nextcloud;
+
</pre>
DELETE FROM oc_file_locks WHERE 1;
 
quit
 

Version vom 11. März 2026, 14:37 Uhr

Nextcloud Installation (Debian 13)

System vorbereiten

  • apt update
  • apt install apache2 mariadb-server php php-gd php-curl php-zip php-mysql php-xml php-mbstring php-intl php-bcmath php-gmp php-imagick php-cli libapache2-mod-php unzip wget -y

Apache Module aktivieren

  • a2enmod rewrite headers env dir mime
  • systemctl restart apache2

Datenbank erstellen

  • mysql -u root
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'secret';

GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';

FLUSH PRIVILEGES;

EXIT;

Nextcloud herunterladen

Rechte setzen

  • chown -R www-data:www-data /var/www/nextcloud
  • chmod -R 750 /var/www/nextcloud

Apache VirtualHost erstellen

  • vi /etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80>

ServerName cloud.local
DocumentRoot /var/www/nextcloud

<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>

</VirtualHost>

Website aktivieren

  • a2ensite nextcloud.conf
  • systemctl reload apache2

Nextcloud Installation im Browser starten

Cronjob einrichten

  • crontab -u www-data -e
*/5 * * * * php -f /var/www/nextcloud/cron.php