GNU/Linux >> LINUX-Kenntnisse >  >> Debian

So installieren Sie NextCloud unter Debian 10

NextCloud ist ein kostenloser und quelloffener File-Hosting- und File-Sharing-Server, der vom ownCloud-Projekt abgezweigt wurde. Es ist anderen Filesharing-Diensten wie Google Drive, Dropbox und iCloud sehr ähnlich. Mit NextCloud können Sie Dateien, Dokumente, Bilder, Filme und Videos zentral speichern. Mit NextCloud können Sie Dateien, Kontakte und andere Medien mit Ihren Freunden und Kunden teilen. NextCloud lässt sich in E-Mail, Kalender, Kontakte und andere Funktionen integrieren, die Ihren Teams helfen, ihre Arbeit schneller und einfacher zu erledigen. Sie können den NextCloud-Client auf einem Desktop-Computer installieren, um Dateien mit Ihrem Nextcloud-Server zu synchronisieren. Desktop-Clients sind für die meisten Betriebssysteme verfügbar, einschließlich Windows, macOS, FreeBSD und Linux.

In diesem Tutorial erklären wir, wie Sie NextCloud installieren und mit Let’s Encrypt SSL unter Debian 10 sichern.

Voraussetzungen

  • Ein Server mit Debian 10.
  • Ein gültiger Domänenname, auf den Ihre Server-IP verweist. In diesem Tutorial verwenden wir die Domäne nextcloud.example.com.
  • Auf Ihrem Server ist ein Root-Passwort konfiguriert.

Installieren Sie Apache, MariaDB und PHP

NextCloud läuft auf dem Webserver, ist in PHP geschrieben und verwendet MariaDB, um ihre Daten zu speichern. Sie müssen also Apache, MariaDB, PHP und andere erforderliche Pakete auf Ihrem System installieren. Sie können alle installieren, indem Sie den folgenden Befehl ausführen:

apt-get install apache2 libapache2-mod-php mariadb-server php-xml php-cli php-cgi php-mysql php-mbstring php-gd php-curl php-zip wget unzip -y

Sobald alle Pakete installiert sind, öffnen Sie die Datei php.ini und passen Sie einige empfohlene Einstellungen an:

nano /etc/php/7.3/apache2/php.ini

Ändern Sie die folgenden Einstellungen:

memory_limit = 512M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 300
date.timezone = Asia/Kolkata

Speichern und schließen Sie die Datei, wenn Sie fertig sind. Starten Sie dann den Apache- und MariaDB-Dienst und ermöglichen Sie ihnen, nach dem Systemneustart mit dem folgenden Befehl zu starten:

systemctl start apache2
systemctl start mariadb
systemctl enable apache2
systemctl enable mariadb

Sobald Sie fertig sind, können Sie mit dem nächsten Schritt fortfahren.

Datenbank für NextCloud konfigurieren

Als nächstes müssen Sie eine Datenbank und einen Datenbankbenutzer für NextCloud erstellen. Melden Sie sich dazu mit dem folgenden Befehl bei der MariaDB-Shell an:

mysql -u root -p

Geben Sie Ihr Root-Passwort ein, wenn Sie dazu aufgefordert werden, und erstellen Sie dann eine Datenbank und einen Benutzer mit dem folgenden Befehl:

MariaDB [(none)]> CREATE DATABASE nextclouddb;
MariaDB [(none)]> CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password';

Als nächstes erteilen Sie nextclouddb mit dem folgenden Befehl alle Privilegien:

MariaDB [(none)]> GRANT ALL ON nextclouddb.* TO 'nextclouduser'@'localhost';

Löschen Sie als Nächstes die Berechtigungen und verlassen Sie die MariaDB-Shell mit dem folgenden Befehl:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Sobald Sie fertig sind, können Sie mit dem nächsten Schritt fortfahren.

NextCloud herunterladen

Besuchen Sie zunächst die NextCloud-Downloadseite und laden Sie die neueste Version von NextCloud auf Ihr System herunter. Zum Zeitpunkt des Schreibens dieses Artikels ist die neueste Version von NextCloud 17.0.1. Sie können es mit dem folgenden Befehl herunterladen:

wget https://download.nextcloud.com/server/releases/nextcloud-17.0.1.zip

Sobald der Download abgeschlossen ist, entpacken Sie die heruntergeladene Datei mit dem folgenden Befehl:

unzip nextcloud-17.0.1.zip

Verschieben Sie als Nächstes das extrahierte Verzeichnis in das Apache-Web-Root-Verzeichnis:

mv nextcloud /var/www/html/

Als nächstes erteilen Sie dem Nextcloud-Verzeichnis mit dem folgenden Befehl die richtigen Berechtigungen:

chown -R www-data:www-data /var/www/html/nextcloud/
chmod -R 755 /var/www/html/nextcloud/

Wenn Sie fertig sind, können Sie mit dem nächsten Schritt fortfahren.

Apache für NextCloud konfigurieren

Als Nächstes müssen Sie eine Konfigurationsdatei für den virtuellen Apache-Host erstellen, um NextCloud zu bedienen. Sie können es mit dem folgenden Befehl erstellen:

nano /etc/apache2/sites-available/nextcloud.conf

Fügen Sie die folgenden Zeilen hinzu:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/nextcloud/
     ServerName nextcloud.example.com

     Alias /nextcloud "/var/www/html/nextcloud/"

     <Directory /var/www/html/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
          <IfModule mod_dav.c>
            Dav off
          </IfModule>
        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Speichern und schließen Sie die Datei, wenn Sie fertig sind. Aktivieren Sie dann die virtuelle Apache-Hostdatei und andere erforderliche Module mit den folgenden Befehlen:

a2ensite nextcloud.conf
a2enmod rewrite
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime

Starten Sie abschließend den Apache-Dienst neu, um die neue Konfiguration zu übernehmen:

systemctl restart apache2

Sichern Sie NextCloud mit Let's Encrypt Free SSL

NextCloud ist jetzt installiert und konfiguriert. Als nächstes wird empfohlen, es mit Let's Encrypt free SSL zu sichern. Installieren Sie dazu zunächst den Certbot-Client mit dem folgenden Befehl:

apt-get install python-certbot-apache -y

Nach der Installation können Sie den folgenden Befehl ausführen, um das Let's Encrypt-Zertifikat für Ihre Domäne nextcloud.example.com zu installieren.

certbot --apache -d nextcloud.example.com

Während der Installation werden Sie aufgefordert, Ihre E-Mail-Adresse anzugeben und die Nutzungsbedingungen wie unten gezeigt zu akzeptieren:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for nextcloud.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/nextcloud-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/nextcloud-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/nextcloud-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Geben Sie als Nächstes 2 ein und drücken Sie die Eingabetaste, um ein kostenloses SSL-Zertifikat für Ihre Domain herunterzuladen und zu installieren. Sobald die Installation erfolgreich abgeschlossen wurde. Sie sollten die folgende Ausgabe erhalten:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/nextcloud.conf to ssl vhost in /etc/apache2/sites-available/
nextcloud-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://nextcloud.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=nextcloud.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/example.com/privkey.pem
Your cert will expire on 2019-10-22. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le

Wenn Sie fertig sind, können Sie mit dem nächsten Schritt fortfahren.

Zugriff auf die NextCloud-Weboberfläche

Ihre NextCloud ist jetzt konfiguriert und mit Let’s Encrypt SSL gesichert. Öffnen Sie als Nächstes Ihren Webbrowser und geben Sie die URL https://nextcloud.example.com ein . Sie werden auf die folgende Seite weitergeleitet:

Geben Sie nun Ihren Admin-Benutzernamen und Ihr Passwort, den Datenordner, die richtigen Datenbankanmeldeinformationen ein und klicken Sie auf Fertig stellen Einrichtung Taste. Sie werden auf der folgenden Seite zum NextCloud-Dashboard weitergeleitet:

Das war's für jetzt.

Schlussfolgerung

Herzliche Glückwünsche! Sie haben NextCloud erfolgreich mit Let's Encrypt Free SSL auf Debian 10 installiert und gesichert. Sie können jetzt Dateien, Dokumente und Medien ganz einfach mit anderen Benutzern über die NextCloud-Weboberfläche teilen.


Debian
  1. So installieren Sie MariaDB unter Debian 9

  2. So installieren Sie Nextcloud auf Debian 9

  3. So installieren Sie MariaDB 10.x auf Debian 11

  4. So installieren Sie NextCloud 13 auf Debian 9

  5. So installieren Sie MariaDB unter Debian 11

So installieren Sie Nextcloud unter Debian 8

So installieren Sie OwnCloud unter Debian 9

So installieren Sie Joomla unter Debian 10

So installieren Sie LibreNMS unter Debian 10

So installieren Sie MariaDB unter Debian 11

So installieren Sie Nextcloud unter Debian 11