Benutzer-Werkzeuge

Webseiten-Werkzeuge


nextcloud

Dies ist eine alte Version des Dokuments!


Nextcloud 18 mit Apache2 auf dem Raspberry Pi 4 ohne Fehler installieren.

Nextcloud 18 fehlerlos und automatisch installieren.
 # Eure Daten Username,Passwort,Pfad usw eintragen. Wird für die automatische Installation benötigt. Falls ihr Befehl für Befehl in die Bash kopiert, müsst ihr die Daten auch Zeile für Zeile in die bash kopieren und Enter drücken. Ohne das funktioniert es nicht, da alles dynamisch zur Selbstanpassung geschrieben wurde.
 
 ##############################################################
 # MySQL Daten
 root_pw=Euer root MySQL Passwort
 sql_user=Euer SQL User
 sql_user_pw=Euer SQL User Passwort
 database=nextcloud # Eure Datenbank Name, die wir erstellen
 
 # Nextcloud Daten
 auser=Benutzername
 apass=Benutzerpasswort
 adir=/var/www/nextcloud # müsste passen 🙂
 trust=raspberrypi # müsste passen 🙂
 trust1=Euer DynDNS
 ##############################################################
 

# mit root anmelden sudo -i

# PHP Repo hinzufügen wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add - echo „deb https://packages.sury.org/php/ buster main“ | tee /etc/apt/sources.list.d/php.list

# Zuerst einmal updaten, da wir das PHP Repo hinzugefügt haben. apt update -y && apt upgrade -y

# Apache und Mysql installieren apt install apache2 mariadb-server zip unzip apt-transport-https \ libmariadb-dev-compat libmariadb-dev libapache2-mod-security2 \ imagemagick

# PHP 7.3 und benötigte Module installieren apt install php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl \

php7.3-zip php7.3-intl libapache2-mod-php7.3 php7.3-mbstring  \
php7.3-bz2 php7.3-cli php7.3-common php7.3-ssh2 php7.3-sqlite3 \
php7.3-xml php7.3-json php7.3 php-apcu php-imagick

# Eine Seite für Apache erstellen cat «EOF > /etc/apache2/sites-available/nextcloud.conf <VirtualHost *:443>

ServerName localhost # Ersetzt localhost mit euren dyndns 
ServerAdmin webmaster@localhost
  
DocumentRoot $adir
ProxyErrorOverride on

<If „-f %{SCRIPT_FILENAME}“>

      SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"

</If>

LogLevel warn

ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined

<Directory /var/www>

Options Indexes FollowSymLinks
AllowOverride All
Require all granted

</Directory>

Redirect 301 /.well-known/carddav /remote.php/dav Redirect 301 /.well-known/caldav /remote.php/dav

<IfModule mod_headers.c>

Header always set Strict-Transport-Security "max-age=15552000; inextcloudludeSubDomains"
Header always set Referrer-Policy "no-referrer"

</IfModule>

</VirtualHost> EOF

# Nextcloud Apache Seite aktivieren a2ensite nextcloud.conf

# Apache module aktivieren a2enmod headers proxy_fcgi proxy_balancer proxy proxy_http

# Apache neu starten service apache2 restart

# Wenn ihr dyndns benutzt, letsencrypt SSL installieren apt install python3-certbot-apache certbot -d „euer dyndns“ –apache

# Apache erneut neu starten service apache2 restart

# MySQL (MariaDB) vorbereiten mysql_secure_installation

# MySQL starten systemctl start mysql

# MySQL Datenbank anlegen mysql -u root -p$root_pw -e „CREATE DATABASE $database;“

# MySQL User anlegen und die Rechte vergeben mysql -u root -p$root_pw -e „CREATE USER '$sql_user'@'%' IDENTIFIED BY '$sql_user_pw'; \

  GRANT ALL PRIVILEGES ON $database.* TO '$sql_user'@'localhost';FLUSH PRIVILEGES;"

# Für Nextcloud müssen wir ein paar Einstellungen in der php.ini ändern sed -i „s/memory_limit = 128M/memory_limit = 512M/“ /etc/php/7.3/fpm/php.ini sed -i „s/;opcache.enable=.*/opcache.enable=1/“ /etc/php/7.3/fpm/php.ini sed -i „s/;opcache.enable_cli=.*/opcache.enable_cli=1/“ /etc/php/7.3/fpm/php.ini sed -i „s/;opcache.interned_strings_buffer=.*/opcache.interned_strings_buffer=8/“ /etc/php/7.3/fpm/php.ini sed -i „s/;opcache.max_accelerated_files=.*/opcache.max_accelerated_files=10000/“ /etc/php/7.3/fpm/php.ini sed -i „s/;opcache.memory_consumption=.*/opcache.memory_consumption=128/“ /etc/php/7.3/fpm/php.ini sed -i „s/;opcache.save_comments=.*/opcache.save_comments=1/“ /etc/php/7.3/fpm/php.ini sed -i „s/;opcache.revalidate_freq=.*/opcache.revalidate_freq=1/“ /etc/php/7.3/fpm/php.ini

# PHP 7.3 und apache2 neu starten service php7.3-fpm restart service apache2 restart

# Pfad festlegen – nicht ändern ddir=$adir/data occ=$adir/occ

# Nextcloud herunter laden und entpacken cd /var/www wget https://download.nextcloud.com/server/releases/latest.zip unzip latest.zip

# Rechte auf den Webserver setzen chown -R www-data:www-data /var/www

# Nextcloud automatisch installiere. Es kommt eine Meldung, wenn es erfolgreich war. su - www-data -s /bin/bash -c „php $occ maintenance:install –database mysql \ –database-name '$database' –database-user '$sql_user' –database-pass '$sql_user_pw' \ –admin-user '$auser' –admin-pass '$apass' –data-dir '$ddir'“

# Hostname und evtl DynDNS in den Einstellungen von Nextcloud # schreiben. Ohne dem habt ihr kein Zugriff auf Nextcloud sudo -u www-data php $occ config:system:set trusted_domains 0 –value=$trust sudo -u www-data php $occ config:system:set trusted_domains 0 –value=$trust1 sed -i „s/output_buffering=.*/output_buffering='Off'/“ $adir/.user.ini

# Cron aktivieren sudo -u www-data php $occ background:cron

# Memory Cache anlegen. Ohne dem kommt ein Fehler sed -i '/);/d' $adir/config/config.php cat «EOF »$adir/config/config.php 'logfile' ⇒ '$adir/nextcloud.log', 'logtimezone' ⇒ 'Europe/Berlin', 'memcache.local' ⇒ '\\OC\\Memcache\\APCu', ); EOF

# Apache stopen um die Nextcloud Daten zu optimieren. Ist erforderlich. service apache2 stop sudo -u www-data php $occ db:add-missing-indices sudo -u www-data php $occ db:convert-filecache-bigint sudo -u www-data php $adir/cron.php

# Cron anlegen (crontab -u www-data -l ; echo „*/5 * * * * php -f $adir/cron.php > /dev/null 2>&1“) | crontab -u www-data -

# Apache starten service apache2 start

# MySQL Einstellungen für Nextcloud cat «EOF > /etc/mysql/conf.d/mysql.cnf [mysql] innodb_buffer_pool_size=1G innodb_io_capacity=4000 EOF

# MySQL restart service mysql restart

# Fertig. Viel Spaß

nextcloud.1639587573.txt.gz · Zuletzt geändert: 2021/12/15 17:59 von noone

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki