Installation Nextcloud unter Ubuntu 22.04 LTS: Unterschied zwischen den Versionen

Aus Privates Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(62 dazwischenliegende Versionen von 4 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
Diese Anleistung basiert auf folgender Anleitung:   
Diese Anleistung basiert auf folgender Anleitung:   


[https://apfelcast.com/nextcloud-25-auf-linux-server-ubuntu-22-04-installieren-einfache-anleitung/]
[https://apfelcast.com/nextcloud-25-auf-linux-server-ubuntu-22-04-installieren-einfache-anleitung/ https://apfelcast.com/nextcloud-25-auf-linux-server-ubuntu-22-04-installieren-einfache-anleitung]
 


Die beiden zusätzlichen Änderungen am Schuss ergeben sich nach dem überprüfen der Einstellungen in Nextcloud.
Die beiden zusätzlichen Änderungen am Schuss ergeben sich nach dem überprüfen der Einstellungen in Nextcloud.




--------------------


Nextcloud 25 Installation auf Basis Ubuntu 22.04 LTS
'''Nextcloud 25 Installation auf Basis Ubuntu 22.04 LTS'''
-------------------
-------------------


#Betriebsystem auf aktuellen Stand bringen  
*Betriebsystem auf aktuellen Stand bringen
apt update && apt upgrade -y
apt update && apt upgrade -y
 
 
*Installion apache
apt install apache2
 
 
*Installion PHP 8.1
apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update
 
 
*Installion PHP 8.1  Module
apt install php8.1 libapache2-mod-php8.1 php8.1-zip php-dompdf php8.1-xml php8.1-mbstring php8.1-gd php8.1-curl php8.1-imagick libmagickcore-6.q16-6-extra php8.1-intl php8.1-bcmath php8.1-gmp php8.1-cli php8.1-mysql php8.1-zip php8.1-gd  php8.1-mbstring php8.1-curl php8.1-xml php-pear unzip nano php8.1-apcu redis-server ufw php8.1-redis
 
*Installion PHP 8.3  Module ohne php-dompdf wie bei PHP 8.1 Module
apt install php8.3 libapache2-mod-php8.3 php8.3-zip php8.3-xml php8.3-mbstring php8.3-gd php8.3-curl php8.3-imagick libmagickcore-6.q16-6-extra php8.3-intl php8.3-bcmath php8.3-gmp php8.3-cli php8.3-mysql php8.3-zip php8.3-gd  php8.3-mbstring php8.3-curl php8.3-xml php-pear unzip nano php8.3-apcu redis-server ufw php8.3-redis
 
 
 
 
*anpassen der PHP.ini Datei
nano /etc/php/8.1/apache2/php.ini
bzw.
nano /etc/php/8.3/apache2/php.ini
 
memory_limit = 1024M
upload_max_filesize = 16G
post_max_size = 16G
date.timezone = Europe/Berlin
output_buffering = Off
 
 
*Installation Datenbank Server
apt install mariadb-server
 
 
*Maria DB Server Konfiguration
mysql_secure_installation


# Installing apache
apt install apache2


# Install PHP 8.1
*öffnen SQL Dialog
apt install software-properties-common
mysql
add-apt-repository ppa:ondrej/php
apt update


# Install PHP 8.1 & Moduls
apt install php8.1 libapache2-mod-php8.1 php8.1-zip php-dompdf php8.1-xml php8.1-mbstring php8.1-gd php8.1-curl php8.1-imagick libmagickcore-6.q16-6-extra php8.1-intl php8.1-bcmath php8.1-gmp php8.1-cli php8.1-mysql php8.1-zip php8.1-gd  php8.1-mbstring php8.1-curl php8.1-xml php-pear unzip nano php8.1-apcu redis-server ufw php8.1-redis


# adjust PHP.ini file
*create database calles nextcloud
nano /etc/php/8.1/apache2/php.ini
CREATE DATABASE nextcloud;


memory_limit = 1024M
upload_max_filesize = 16G
post_max_size = 16G
date.timezone = Europe/Berlin
output_buffering = Off


# Install Databse Server
*create database user with password
apt install mariadb-server
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password_here';


# Maria DB Server Konfiguration
mysql_secure_installation


# open SQL dialoge
*grant accesss to databse
mysql
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';


# create database calles nextcloud
CREATE DATABASE nextcloud;


# create database user with password
*save changes and exit
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password_here';
FLUSH PRIVILEGES;
EXIT;


#grant accesss to databse
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';


#save changes and exit
*Download lastest nextcloud version
FLUSH PRIVILEGES;
cd /tmp && wget https://download.nextcloud.com/server/releases/latest.zip
EXIT;
unzip latest.zip
mv nextcloud /var/www/


# Download lastest nextcloud version
cd /tmp && wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
mv nextcloud /var/www/


#create new conf
*create new conf
nano /etc/apache2/sites-available/nextcloud.conf
 
<VirtualHost *:80>
nano /etc/apache2/sites-available/nextcloud.conf </br>
ServerAdmin master@domain.com
<VirtualHost *:80>
DocumentRoot /var/www/nextcloud/
    ServerAdmin master@domain.com
ServerName demo.domain.com
    DocumentRoot /var/www/nextcloud/
ServerAlias www.demo.domain.com
    ServerName demo.domain.com
    ServerAlias www.demo.domain.com
    
    
Alias /nextcloud "/var/www/nextcloud/"
    Alias /nextcloud "/var/www/nextcloud/" </br>
<Directory /var/www/nextcloud/>
    <Directory /var/www/nextcloud/>
Options +FollowSymlinks
      Options +FollowSymlinks
AllowOverride All
      AllowOverride All
Require all granted
      Require all granted
  <IfModule mod_dav.c>
      <IfModule mod_dav.c>
Dav off
          Dav off
  </IfModule>
      </IfModule>
SetEnv HOME /var/www/nextcloud
      SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
      SetEnv HTTP_HOME /var/www/nextcloud
</Directory>
    </Directory> </br>
ErrorLog ${APACHE_LOG_DIR}/error.log
    ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
</VirtualHost>


# Enable the NextCloud and Rewrite Module


a2ensite nextcloud.conf
*Enable the NextCloud and Rewrite Module
a2enmod rewrite
a2ensite nextcloud.conf
a2enmod headers
a2enmod rewrite
a2enmod env
a2enmod headers
a2enmod dir
a2enmod env
a2enmod mime
a2enmod dir
a2enmod mime


# restart apache
service apache2 restart


# prepare data folder
*restart apache
mkdir /home/data/
service apache2 restart
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
*prepare data folder
mkdir /home/data/
chown -R www-data:www-data /home/data/


#install certbot
apt install certbot python3-certbot-apache


certbot --apache -m master@domain.com -d cloud.domain.com
*prepare nextcloud Folder
#--> only lasts 90 days
chown -R www-data:www-data /var/www/nextcloud/
chmod -R 755 /var/www/nextcloud/


# gegebenenfall das Paket cron installieren
 
#install crontab
*install certbot and create Let's Encrypt SSL-Certificate
crontab -e
apt install certbot python3-certbot-apache
40 3 * * 0 letsencrypt renew >> /var/log/letsencrypt-renew.log && service apache2 reload > /dev/null 2>&1
 
*Falls diese Maschine hinter einem Reverseproxy platziert ist, dann vorübergehend Port 80 und Port 443 direkt auf diese Maschine weiterleiten.
*Nur dann funktioniert der nächste Schritt und unter /etc/apache2/sites_available die Datei nextcloud-le-ssl.conf angelegt.
*Nach dem nächsten Schritt kann das Portforwarding sofern vorhanden wieder auf den Reverse Proxy umgestellt werden.
 
* erstes Zertifikat anfordern
certbot --apache -m master@domain.com -d cloud.domain.com
 
--> only lasts 90 days
 
*gegebenenfall das Paket cron installieren
 
install crontab
crontab -e
40 3 * * 0 letsencrypt renew >> /var/log/letsencrypt-renew.log && service apache2 reload > /dev/null 2>&1
 
*Falls ein Revers Proxy im Einsatz ist, dann bitte den nachfolgenden Link beachten.
[[Nextcloud Server hinter einem Nginx Reverse Proxy Server]]


--> Domain ansurfen und Einrichtung abschließen
--> Domain ansurfen und Einrichtung abschließen
Zeile 122: Zeile 155:
--------------------
--------------------


Abschliessende Änderungen:
'''Abschliessende Änderungen:'''


1. Erweitern der Datei : /etc/apache2/sites-available/nextcloud-le-ssl.conf um folgenden Eintrag
*Erweitern der Datei : /etc/apache2/sites-available/nextcloud-le-ssl.conf um folgenden Eintrag
Fettgedrucktes unter Servername einfügen


# Strict-Transport-Security:
Strict-Transport-Security:
   <VirtualHost *:443>
   <VirtualHost *:443>
  ServerName cloud.nextcloud.com
    ServerName cloud.nextcloud.com
<IfModule mod_headers.c>
    <B><IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
        Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
    </IfModule></B>
</VirtualHost>
  </VirtualHost>




2. Erweitern der Einstellungen in der Datein  /var/www/nextcloud/config/config.php um folgenden Eintrag
*Erweitern der Einstellungen in der Datein  /var/www/nextcloud/config/config.php um folgenden Eintrag
'default_phone_region' => 'DE',
'default_phone_region' => 'DE',
(bei einer Snap Installation unter Ubuntu 20.04 liegt die Datei unter /var/snap/nextcloud/current/config/config.php)
(bei einer Snap Installation unter Ubuntu 20.04 liegt die Datei unter /var/snap/nextcloud/current/config/config.php)
 
*Erweiterung der Crontabelle des Users www-data für regelmäßige vom System auszuführende Wartungsaufgaben alle 5 Minuten. [[https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html Hinweis]]
crontab -u www-data -e
 
*/5 * * * * php -f /var/www/nextcloud/cron.php
 
*Anpassungen bzgl. Wartungsfenster. Zeitintensive Operationen in die Nacht verlagern. (hier 1:00 entspricht --value=1)
sudo -u www-data php occ config:system:set maintenance_window_start --type=integer --value=1
 
*Hinweise in den Verwaltungseinstellungen
 
The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 8.
 
Abhilfe: in der /etc/php/8.1/apache2/php.ini    den Wert opcache.interned_strings_buffer=8  auf einen größeren Wert stellen z.B 20

Aktuelle Version vom 24. Juni 2024, 13:47 Uhr

Diese Anleistung basiert auf folgender Anleitung:

https://apfelcast.com/nextcloud-25-auf-linux-server-ubuntu-22-04-installieren-einfache-anleitung

Die beiden zusätzlichen Änderungen am Schuss ergeben sich nach dem überprüfen der Einstellungen in Nextcloud.


Nextcloud 25 Installation auf Basis Ubuntu 22.04 LTS


  • Betriebsystem auf aktuellen Stand bringen
apt update && apt upgrade -y


  • Installion apache
apt install apache2


  • Installion PHP 8.1
apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update


  • Installion PHP 8.1 Module
apt install php8.1 libapache2-mod-php8.1 php8.1-zip php-dompdf php8.1-xml php8.1-mbstring php8.1-gd php8.1-curl php8.1-imagick libmagickcore-6.q16-6-extra php8.1-intl php8.1-bcmath php8.1-gmp php8.1-cli php8.1-mysql php8.1-zip php8.1-gd  php8.1-mbstring php8.1-curl php8.1-xml php-pear unzip nano php8.1-apcu redis-server ufw php8.1-redis
  • Installion PHP 8.3 Module ohne php-dompdf wie bei PHP 8.1 Module
apt install php8.3 libapache2-mod-php8.3 php8.3-zip php8.3-xml php8.3-mbstring php8.3-gd php8.3-curl php8.3-imagick libmagickcore-6.q16-6-extra php8.3-intl php8.3-bcmath php8.3-gmp php8.3-cli php8.3-mysql php8.3-zip php8.3-gd  php8.3-mbstring php8.3-curl php8.3-xml php-pear unzip nano php8.3-apcu redis-server ufw php8.3-redis



  • anpassen der PHP.ini Datei
nano /etc/php/8.1/apache2/php.ini
bzw.
nano /etc/php/8.3/apache2/php.ini
memory_limit = 1024M
upload_max_filesize = 16G
post_max_size = 16G
date.timezone = Europe/Berlin
output_buffering = Off


  • Installation Datenbank Server
apt install mariadb-server


  • Maria DB Server Konfiguration
mysql_secure_installation


  • öffnen SQL Dialog
mysql


  • create database calles nextcloud
CREATE DATABASE nextcloud; 


  • create database user with password
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password_here';


  • 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/


  • create new conf
nano /etc/apache2/sites-available/nextcloud.conf 
<VirtualHost *:80> ServerAdmin master@domain.com DocumentRoot /var/www/nextcloud/ ServerName demo.domain.com ServerAlias www.demo.domain.com 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
service apache2 restart


  • prepare data folder
mkdir /home/data/
chown -R www-data:www-data /home/data/


  • prepare nextcloud Folder
chown -R www-data:www-data /var/www/nextcloud/
chmod -R 755 /var/www/nextcloud/


  • install certbot and create Let's Encrypt SSL-Certificate
apt install certbot python3-certbot-apache
  • Falls diese Maschine hinter einem Reverseproxy platziert ist, dann vorübergehend Port 80 und Port 443 direkt auf diese Maschine weiterleiten.
  • Nur dann funktioniert der nächste Schritt und unter /etc/apache2/sites_available die Datei nextcloud-le-ssl.conf angelegt.
  • Nach dem nächsten Schritt kann das Portforwarding sofern vorhanden wieder auf den Reverse Proxy umgestellt werden.
  • erstes Zertifikat anfordern
certbot --apache -m master@domain.com -d cloud.domain.com


--> only lasts 90 days

  • gegebenenfall das Paket cron installieren
install crontab
crontab -e
40 3 * * 0 letsencrypt renew >> /var/log/letsencrypt-renew.log && service apache2 reload > /dev/null 2>&1
  • Falls ein Revers Proxy im Einsatz ist, dann bitte den nachfolgenden Link beachten.

Nextcloud Server hinter einem Nginx Reverse Proxy Server

--> Domain ansurfen und Einrichtung abschließen



Abschliessende Änderungen:

  • Erweitern der Datei : /etc/apache2/sites-available/nextcloud-le-ssl.conf um folgenden Eintrag
Fettgedrucktes unter Servername einfügen 
Strict-Transport-Security:
 <VirtualHost *:443>
    ServerName cloud.nextcloud.com
    <IfModule mod_headers.c>
       Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
    </IfModule>
 </VirtualHost>


  • Erweitern der Einstellungen in der Datein /var/www/nextcloud/config/config.php um folgenden Eintrag
'default_phone_region' => 'DE',

(bei einer Snap Installation unter Ubuntu 20.04 liegt die Datei unter /var/snap/nextcloud/current/config/config.php)

  • Erweiterung der Crontabelle des Users www-data für regelmäßige vom System auszuführende Wartungsaufgaben alle 5 Minuten. [Hinweis]
crontab -u www-data -e
*/5 * * * * php -f /var/www/nextcloud/cron.php
  • Anpassungen bzgl. Wartungsfenster. Zeitintensive Operationen in die Nacht verlagern. (hier 1:00 entspricht --value=1)
sudo -u www-data php occ config:system:set maintenance_window_start --type=integer --value=1
  • Hinweise in den Verwaltungseinstellungen
The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 8.
Abhilfe: in der /etc/php/8.1/apache2/php.ini     den Wert opcache.interned_strings_buffer=8  auf einen größeren Wert stellen z.B 20