Skip to main content

Nextcloud installation

Hier wird dir einfach erklärt wie du Nextcloud auf deinem Server installierst.

Was du brauchst

um Nextcloud zu installieren:

  • Ubuntu Version 24.0.2
  • root rechte
  • Apache2

Root rechte ergattern

sudo su root

Updaten

update zuerst deine Ubuntu Instanz

Ubuntu Updaten
apt update && apt upgrade -y

Apache Installieren

Mit folgenden Befehlen Apache installieren:

# Installing apache
apt install apache2 -y

PHP installieren

Mit folgenden befehlen installierst du PHP mit allen benötigten plugins

PHP
# Install PHP 8.2 
apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update

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

PHP.ini Datei

Nun muss die PHP.ini Datei abgeändert werden. Dafür folge folgenden schritten:

Datei öffnen

nano /etc/php/8.2/apache2/php.ini

Werte abändern

Ändere nun folgende werte ab. Mit STRG + W kannst du suchen.

memory_limit = 8096
upload_max_filesize = 10000G
post_max_size = 10000G
date.timezone = Europe/Berlin
output_buffering = Off

opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=64
opcache.max_accelerated_files=10000
opcache.memory_consumption=1024
opcache.save_comments=1
opcache.revalidate_freq=1

Maria-Datenbank Server

Jetzt wird MariaDB installiert:

apt install mariadb-server

Maria DB Konfiguration

MariaDB config anpassen:

# 1.
mysql_secure_installation

# open SQL dialoge
mysql

# create database called 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;

Nextcloud herunterladen

Nextcloud mit den folgenden befehlen herunterladen und in das gewünschte Verzeichnis verschiebnen

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

Apache config

Apache Webserver erstellen und anpassen

Apache conf
#create new conf
nano /etc/apache2/sites-available/nextcloud.conf

<VirtualHost *:80>
ServerAdmin master@domain.com
DocumentRoot /var/www/nextcloud/
ServerName

<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

Nextcloud einrichten

Datenordner bereitstellen:

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/

Let's Encrypt SSL-Certificate

(Optional, nicht notwendig wenn nur lokales hosting oder via reverse proxy)

apt install certbot python3-certbot-apache

certbot --apache -m master@domain.com -d cloud.domain.com

Nun die domain / ip aufrufen und dem Einrichtungsassistenten folgen