Skip to main content

Nextcloud

Diese Anleitung führt dich durch die Installation von Nextcloud 25 auf einem Ubuntu/Debian-Server.

Wichtiger Hinweis: Alle Befehle müssen ggf. mit sudo ausgeführt werden, falls du nicht als Root-Benutzer angemeldet bist.

1. System aktualisieren

Zuerst bringen wir alle Pakete auf den neuesten Stand.

sudo apt update && sudo apt upgrade -y

2. Apache Webserver installieren

sudo apt install apache2

3. PHP 8.1 und Module installieren

Wir fügen das PPA für PHP 8.1 hinzu und installieren alle notwendigen Module.

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

sudo 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

4. PHP.ini Konfiguration

Passe die Limits in der Datei /etc/php/8.1/apache2/php.ini mit nano an. Du kannst mit [STRG] + [W] suchen. Speichere und schließe die Datei mit [STRG] + [X]

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

5. Datenbank (MariaDB) einrichten

sudo apt install mariadb-server
sudo mysql_secure_installation

Melde dich an der SQL-Konsole an:

sudo mysql

Erstelle die Datenbank und den Benutzer:

CREATE DATABASE nextcloud; 
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password_here';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

6. Nextcloud Download & Vorbereitung

cd /tmp && wget [https://download.nextcloud.com/server/releases/latest.zip](https://download.nextcloud.com/server/releases/latest.zip)
unzip latest.zip
sudo mv nextcloud /var/www/

7. Apache VirtualHost erstellen

Erstelle die Datei /etc/apache2/sites-available/nextcloud.conf:

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/nextcloud/
ServerName cloud.domain.org

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

8. Apache Module & Neustart

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers env dir mime
sudo service apache2 restart

9. Berechtigungen & Datenverzeichnis

sudo mkdir /home/data/
sudo chown -R www-data:www-data /home/data/
sudo chown -R www-data:www-data /var/www/nextcloud/
sudo chmod -R 755 /var/www/nextcloud/

10. Let's Encrypt SSL

sudo apt install certbot python3-certbot-apache
sudo certbot --apache -m [email protected] -d cloud.domain.com


```python?code_reference&code_event_index=3
content = """# Nextcloud Installation & Konfiguration

Diese Anleitung führt dich durch die Installation von Nextcloud auf einem Ubuntu/Debian-Server.

> **Wichtiger Hinweis:** Alle Befehle müssen ggf. mit `sudo` ausgeführt werden, falls du nicht als Root-Benutzer angemeldet bist.

## 1. System aktualisieren
Zuerst bringen wir alle Pakete auf den neuesten Stand.
```bash
sudo apt update && sudo apt upgrade -y

2. Apache Webserver installieren

sudo apt install apache2

3. PHP 8.1 und Module installieren

Wir fügen das PPA für PHP 8.1 hinzu und installieren alle notwendigen Module.

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

sudo 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

4. PHP.ini Konfiguration

Passe die Limits in der Datei /etc/php/8.1/apache2/php.ini an:

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

5. Datenbank (MariaDB) einrichten

sudo apt install mariadb-server
sudo mysql_secure_installation

Melde dich an der SQL-Konsole an:

sudo mysql

Erstelle die Datenbank und den Benutzer:

CREATE DATABASE nextcloud; 
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password_here';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

6. Nextcloud Download & Vorbereitung

cd /tmp && wget [https://download.nextcloud.com/server/releases/latest.zip](https://download.nextcloud.com/server/releases/latest.zip)
unzip latest.zip
sudo mv nextcloud /var/www/

7. Apache VirtualHost erstellen

Erstelle die Datei /etc/apache2/sites-available/nextcloud.conf:

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/nextcloud/
ServerName cloud.domain.org

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

8. Apache Module & Neustart

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers env dir mime
sudo service apache2 restart

9. Berechtigungen & Datenverzeichnis

sudo mkdir /home/data/
sudo chown -R www-data:www-data /home/data/
sudo chown -R www-data:www-data /var/www/nextcloud/
sudo chmod -R 755 /var/www/nextcloud/

10. Let's Encrypt SSL

sudo apt install certbot python3-certbot-apache
sudo certbot --apache -m [email protected] -d cloud.domain.com