Nextcloud
| ID | 100 |
| Name | pNextcloud |
| OS | Ubuntu 20.04.3 LTS |
| Root Disk | 200 G |
| RAM | 16 G |
| Cores | 4 |
| Netzwerk | 192.168.1.230 |
Aktuelle Version: 25.0.1
PHP 8.0
Installation
LAMP-Stack Installation
- L - Linux
- A - Apache
- M - Maria DB
- P - PHP
Update Ubuntu Server
apt-get update && apt-get upgrade -y
Install Apache
apt install apache2
Install PHP 8.0
pt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update
apt install php8.0
Install PHP Moduls
apt install libapache2-mod-php8.0 php8.0-zip php-dompdf php8.0-xml php8.0-mbstring php8.0-gd php8.0-curl php8.0-imagick libmagickcore-6.q16-6-extra php8.0-intl php8.0-bcmath php8.0-gmp php8.0-cli php-json php8.0-mysql php8.0-zip php8.0-gd php8.0-mbstring php8.0-curl php8.0-xml php-pear unzip nano php8.0-apcu redis-server php8.0-redis
adjust PHP.ini file
nano /etc/php/8.0/apache2/php.ini
memory_limit = 4048M
upload_max_filesize = 25G
post_max_size = 25G
date.timezone = Europe/Berlin
output_buffering = Off
Install Databse Server
apt install mariadb-server
Maria DB Server Konfiguration
mysql_secure_installation
mySQL-Root Passwort: Passwort1
# open SQL dialoge
mysql
# create database calles nextcloud
CREATE DATABASE nextcloud;
# create database user with password
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'Passwort2';
#grant accesss to databse
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
#save changes and exit
FLUSH PRIVILEGES;
EXIT;
Download lastest nextcloud version
cd /tmp && wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
mv nextcloud /var/www/
Neue Konigurationsdatei für Apache erstellen
nano /etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80>
ServerAdmin master@domain.com
DocumentRoot /var/www/nextcloud/
ServerName nc.juch-online.de
ServerAlias www.nc.juch-online.de
Alias /nextcloud "/var/www/nextcloud/"
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the NextCloud and Rewrite Module
a2ensite nextcloud.conf
a2enmod rewrite
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime
restart apache
systemctl restart apache2.service
Prepare data folder
mkdir /home/data/
chown -R www-data:www-data /home/data/
chown -R www-data:www-data /var/www/nextcloud/
chmod -R 755 /var/www/nextcloud/
Create Let's Encrypt SSL-Certificate
Install certbot
apt install certbot python3-certbot-apache
certbot --apache -m server@mastj.de -d nc.muth.juch-online.de
--> Domain ansurfen und Einrichtung abschließen
Fehlermeldungen beheben
### Phone-Region ###
nano /var/www/nextcloud/config/config.php
add:
"default_locale" => "de",
### PHP-Momory-Caching ###
nano /etc/redis/redis.conf
change port 6379 to port 0
unixsocket /var/run/redis/redis.sock
change: unixsocketperm 700 to unixsocketperm 770
## add redis user to www-data group ###
usermod -a -G redis www-data
## restart apache2 ##
service apache2 restart
## start Redis server ##
service redis-server start
## adjust Nextcloud config.php ##
nano /var/www/nextcloud/config/config.php
add:
'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'filelocking.enabled' => 'true',
'redis' =>
array (
'host' => '/var/run/redis/redis.sock',
'port' => 0,
'timeout' => 0.0,
),
## enable Redis Server on startup ##
systemctl enable redis-server
## restart system ##
reboot
### HTTPS Settings ###
nano /etc/apache2/sites-available/nextcloud-le-ssl.conf
<Directory /var/www/nextcloud/>
....
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSub$
</IfModule>
</Directory>
# adjust PHP.ini file
nano /etc/php/8.0/apache2/php.ini
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
###Security: “__Host-Prefix”, how to fix?###
in der Apache-Conf ist die Zeile mit dem Alias und dem Verzeichnis auszukommentieren
nano /etc/apache2/sites-available/nextcloud-le-ssl.conf
# Alias /nextcloud "/var/www/nextcloud/"
Updates
cd /var/www/nextcloud
sudo -u www-data php updater/updater.phar
Grundsätzlich bei Fehlerbehebungen auf occ-Basis:
cd /var/www/nextcloud
sudo -u www-data php #dann den occ Befehl