Installation von Nextcloud auf bare metal

Manchmal möchte man eine nextcloud auch direkt auf einem Server betreiben. Hier eine Anleitung zur Installation dazu.

Requirements installieren

apt install -y php php-curl php-cli php-mysql php-gd php-common php-xml php-json php-intl php-pear php-imagick php-dev php-common php-mbstring php-zip php-soap php-bz2 php-bcmath php-gmp php-apcu libmagickcore-dev php-ldap apache2


Datenbank installieren

apt install mariadb-server mariadb-client


Nextcloud downloaden

cd /var/www/
wget https://download.nextcloud.com/server/releases/latest.zip


Nextcloud entpacken und Rechte anpassen

unzip latest.zip
chown -R www-data: nextcloud


Datenbank einrichten

MariaDB root Passwort festlegen

mysql_secure_installation


Datenbank und Benutzer erstellen

mariadb -u root -p
CREATE DATABASE nextcloud_db;
CREATE USER nextclouduser@localhost IDENTIFIED BY 'PASSWORT';
GRANT ALL PRIVILEGES ON nextcloud_db.* TO nextclouduser@localhost;
FLUSH PRIVILEGES;
QUIT;


PHP anpassen

sudo nano /etc/php/8.2/apache2/php.ini
...
date.timezone = Europe/Berlin
memory_limit = 512M
upload_max_filesize = 500M
post_max_size = 600M
max_execution_time = 300
file_uploads = On
allow_url_fopen = On
display_errors = Off
output_buffering = Off
zend_extension=opcache
opcache.enable = 1
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 10000
opcache.memory_consumption = 128
opcache.save_comments = 1
opcache.revalidate_freq = 1
...
systemctl restart apache2


Apache Konfigurieren

Konfigurationsdatei für Nextcloud erstellen

cat << EOF > /etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80>
    ServerName $(hostname -f)
    DocumentRoot /var/www/nextcloud/
    # log files
    ErrorLog /var/log/apache2/nextcloud-error.log
    CustomLog /var/log/apache2/nextcloud-access.log combined
    <Directory /var/www/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        <IfModule mod_dav.c>
            Dav off
        </IfModule>
        SetEnv HOME /var/www/nextcloud
        SetEnv HTTP_HOME /var/www/nextcloud
    </Directory>
</VirtualHost>
EOF
a2dissite 000-default.conf
a2dissite default-ssl.conf
a2ensite nextcloud.conf
systemctl reload apache2


Nextcloud starten







Url aufrufen http://meinserver.de Admin Konto anlegen und restliche Konfiguration durchführen