Installation
Installation des Apache und MySQL Servers
Mit dem folgenden Befehl wird der Apache und MySQL Server sowie einige von Nextcloud benötigte Pakete installiert:
1 | sudo apt install -y mariadb-server mariadb-client apache2 apache2-utils php7.3-cli php7.3-common php7.3-mbstring php7.3-gd php-imagick php7.3-intl php7.3-bz2 php7.3-xml php7.3-mysql php7.3-zip php7.3-dev php7.3-curl php7.3-fpm php-dompdf redis-server php-redis php-smbclient php7.3-ldap wget curl sudo unzip |
MySQL Datenbank Setupscript für Mariadatenbanken ausführen:
1 | sudo mysql_secure_installation |
Ausgabe des Setupscripts:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none):
OK, successfully used password, moving on…Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.Set root password? [Y/n] y
New password:your-password
Re-enter new password:your-password
Password updated successfully!
Reloading privilege tables..
… Success!By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] y
… Success!Normally, root should only be allowed to connect from ‚localhost‘. This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] y
… Success!By default, MariaDB comes with a database named ‚test‘ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y
… Success!Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB!
Nextcloud benötigt einige Apache Module sowie das php-fpm Modul. Diese werden wie folgt aktiviert:
1 | a2enmod proxy_fcgi setenvif mpm_event rewrite headers env dir mime ssl http2 |
und danach das PHP-FPM Modul:
1 | a2enconf php7.3-fpm |
Installation der Nextcloud Software
Die Nextcloudsoftware ( v17) kann von der Nextcloud Webseite heruntergeladen werden und wird anschließend in das Webserververzeichnis entpackt und der Zugriff für den Webserver (www-data) gesetzt:
1 2 3 4 | cd /var/www/ sudo wget https://download.nextcloud.com/server/releases/nextcloud-17.0.0.zip sudo unzip nextcloud-17.0.0.zip sudo chown -R www-data.www-data nextcloud |
Installation der SSL Software Certbot
Die Verwaltung von SSL Zertifikaten übernimmt der LetsEncrypt Certbot mit Hilfe des Apache Plugins.
1 | sudo apt install python-certbot-apache certbot |
Konfiguration
Nachdem die Benötigten Pakete sowie Nextcloud installiert und die Webservermodule eingerichtet sind erfolgt nun die Konfiguration des Apache Webserver sowie die Konfiguration von Nextcloud.
Apache Konfiguration
Die grundlegende Apache Konfiguration wird in der Datei /etc/apache2/apache2.conf
vorgenommen. Hier müssen folgende Einträge zum Lesen der .htaccess Dateien geändert werden:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
zu:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Um HTTP/2 zu aktivieren muss die /etc/apache2/apache2.conf
Datei um folgende Zeile ergänzt werden:
Protocols h2 h2c http/1.1
Damit ist die Apache Konfiguration abgeschlossen
PHP Konfiguration
Als nächstes wird PHP für die Verwendung von Nextcloud eingerichtet. Die PHP (v7.3) Konfiguration ist in der Datei /etc/php/7.3/fpm/php.ini
enthalten.
Anpassung folgender Parameter für PHP interne Prozesse:
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
Anpassung folgender Parameter für PHP externe Funktionen:
max_execution_time = 300
max_input_time = 600
memory_limit = 512M
upload_max_filesize = 10240M
Danach wird der Webserver neu gestartet:
1 | sudo systemctl restart apache2 php7.3-fpm |
Datenbank Konfiguration
Nextcloud benötigt einen Datenbankzugriff (User & Datenbank) der wie folgt erstellt wird :
1 | sudo mysql -e " create database nextcloud_db1; create user nextcloud_user1@localhost identified by 'password'; grant all privileges on nextcloud_db1.* to nextcloud_user1@localhost; flush privileges;" |
- Nextcloud Datenbank anlegen:1comming soon / see above
- Nextcloud Benutzer anlegen:1comming soon / see above
Step 5: Create Database https://markus-blog.de/index.php/2019/10/01/how-to-install-nextcloud-17-on-debian-buster-with-mariadb-php7-3-fpm-apache2-and-http-2/
SSL Certbot Konfiguration
Nextcloud Konfiguration
Upgrade Infos
https://docs.nextcloud.com/server/15/admin_manual/maintenance/manual_upgrade.html
https://www.turnkeylinux.org/forum/support/tue-20171003-1200/how-update-nextcloud-lastest-version
Terminal Befehle
Datenverzeichnis aller User neu einlesen :
1 | sudo -u www-data php /var/www/nextcloud/console.php files:scan --all |
Datenverzeichnis einzelner User neu einlesen :
1 | sudo -u www-data php /var/www/nextcloud/console.php files:scan Nutzername |
Nextcloud update via Terminal :
1 | sudo -u www-data php /var/www/nextcloud/updater/updater.phar |
oder
1 | sudo -u www-data php /var/www/nextcloud/occ upgrade |
Sonstiges
Externe Datenverzeichnisse in nextcloud automatisch einlesen : https://decatec.de/home-server/nextcloud-direkter-zugriff-auf-dateien-ueber-das-dateisystem/
by Speefak| www.markus-blog.de | https://docs.nextcloud.com | www.c-rieger.de