Installation Nextcloud unter Ubuntu 22.04 LTS: Unterschied zwischen den Versionen

Aus Privates Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 14: Zeile 14:
*Betriebsystem auf aktuellen Stand bringen
*Betriebsystem auf aktuellen Stand bringen
  apt update && apt upgrade -y
  apt update && apt upgrade -y


*Installion apache
*Installion apache
  apt install apache2
  apt install apache2


*Installion PHP 8.1  
*Installion PHP 8.1  
Zeile 26: Zeile 28:
*Installion PHP 8.1 & Module
*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
  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


*anpassen der PHP.ini Datei
*anpassen der PHP.ini Datei
Zeile 35: Zeile 38:
  date.timezone = Europe/Berlin
  date.timezone = Europe/Berlin
  output_buffering = Off
  output_buffering = Off


*Installation Datenbank Server
*Installation Datenbank Server
  apt install mariadb-server
  apt install mariadb-server


*Maria DB Server Konfiguration
*Maria DB Server Konfiguration
  mysql_secure_installation
  mysql_secure_installation


*öffnen SQL Dialog
*öffnen SQL Dialog
  mysql
  mysql


*create database calles nextcloud
*create database calles nextcloud
  CREATE DATABASE nextcloud;  
  CREATE DATABASE nextcloud;  


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


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


*save changes and exit
*save changes and exit
  FLUSH PRIVILEGES;
  FLUSH PRIVILEGES;
  EXIT;
  EXIT;


*Download lastest nextcloud version
*Download lastest nextcloud version
Zeile 62: Zeile 73:
  unzip latest.zip
  unzip latest.zip
  mv nextcloud /var/www/
  mv nextcloud /var/www/


*create new conf
*create new conf
Zeile 95: Zeile 107:
  a2enmod dir
  a2enmod dir
  a2enmod mime
  a2enmod mime


*restart apache
*restart apache
  service apache2 restart
  service apache2 restart


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


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


*install certbot and create Let's Encrypt SSL-Certificate
*install certbot and create Let's Encrypt SSL-Certificate
  apt install certbot python3-certbot-apache
  apt install certbot python3-certbot-apache


* erstes Zertifikat anfordern
* erstes Zertifikat anfordern
  certbot --apache -m master@domain.com -d cloud.domain.com
  certbot --apache -m master@domain.com -d cloud.domain.com
   
   
--> only lasts 90 days
--> only lasts 90 days


*gegebenenfall das Paket cron installieren
*gegebenenfall das Paket cron installieren
  install crontab
  install crontab
  crontab -e
  crontab -e

Version vom 10. Mai 2023, 13:09 Uhr

Diese Anleistung basiert auf folgender Anleitung:

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

!!! Achtung, die Anleitung im Internet wurde zwischenzeitlich verändert - es fehlen wichtige Stellen.

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


  • anpassen der PHP.ini Datei
nano /etc/php/8.1/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


  • 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

--> Domain ansurfen und Einrichtung abschließen



Abschliessende Änderungen:

  • Erweitern der Datei : /etc/apache2/sites-available/nextcloud-le-ssl.conf um folgenden Eintrag
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)