serveur_hebergement:nextcloud_et_collabora_online

Ceci est une ancienne révision du document !


Nextcloud et Collabora Online

Nextcloud est un logiciel libre qui permet d'héberger des fichiers soit personnels soit en mode collaboratif. Vous pouvez donc y stockez vos fichiers mais aussi, grâce à une multitude d'application, vos mails, votre musique, vos recette de cuisines, vos notes, accéder à Matrix, etc. Vous pouvez également créer et modifier des tableurs et fichiers docx/odt via Collabora Online.

Je vais installer Nextcloud et Collabra Online sur mon Raspberry Pi 4 ARM64 (Collabora Online ne fonctionne pas sur ARM 32 bits)

Il vous faut donc un serveur Linux (basé sur Debian dans mon cas) en 64 bits, MySQL ou PostgreSQL, un serveur web (Apache2 ou Nginx) et PHP.

Pour mon cas, je vais utiliser un Raspberry Pi 4 sous Raspbian ARM64, MySQL et avec Apache2 comme serveur web. Je ne traiterai pas ici de l'installation de Apache2 et MySQL ni de la configuration des certificats SSL déjà traité ici.

Commençons par installer les dépendances :

sudo aptitude install libxml2 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 unzip

On va activer le module apcu qui va gérer le cache de Nextcloud. Ouvrez le fichier php.ini :

sudo nano /etc/php/7.4/cli/php.ini

Dans la partie Dynamic Extensions, ajoutez la ligne suivante :

apc.enable_cli=1

On va commencer par s'occuper de Collabora Online.

On va récupérer le dépôt officiel en commençant pas récupérer les clés de signature :

cd /usr/share/keyrings
sudo wget https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg

On rajoute le dépôt. Créez le fichier de source :

sudo nano /etc/apt/sources.list.d/collaboraonline.sources

Collez-y les lignes suivantes :

Types: deb
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-arm64-ubuntu1804
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg

Ces lignes sont pour un ARM64 (mon Raspberry Pi 4). Si vous êtes sous un Debian 64 bits, remplacez l'url par :

https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-debian11/

Mettez à jour la liste des paquets :

sudo aptitude update

Installez Collabora Online :

sudo aptitude install coolwsd code-brand

On passe à la configuration.

Ouvrez le fichier de configuration :

sudo nano /etc/coolwsd/coolwsd.xml 

Dans la partie “SSL settings”, remplacez les certificats/clés SSL par ceux de Let's Encrypt pour votre domaine afin d'avoir des certificats reconnus :

<cert_file_path desc="Path to the cert file" relative="false">/etc/letsencrypt/live/domaine.fr/cert.pem</cert_file_path>
<key_file_path desc="Path to the key file" relative="false">/etc/letsencrypt/live/domaine.fr/privkey.pem</key_file_path>
<ca_file_path desc="Path to the ca file" relative="false">/etc/letsencrypt/live/domaine.fr/chain.pem</ca_file_path>

Il faut que l'utilisateur cool est accès à ces fichiers.

Redémarrez Collabora Online :

sudo systemctl restart coolwsd.service

On va créer le vhost Apache2 pour y accéder.

Créez le fichier de configuration Apache2 :

sudo nano /etc/apache2/sites-available/office.domaine.fr.conf

Collez-y les lignes suivantes (remplacez domaine.fr par votre domaine) :

<VirtualHost *:80>                                                                                                                                                                                                                          
 
        ServerName office.domaine.fr                                                                                                                                                                                                       
        ServerAdmin fate@domaine.fr                                                                                                                                                                                                        
 
        Redirect / https://office.domaine.fr/                                                                                                                                                                                              
 
</VirtualHost>  
 
<VirtualHost *:443>                              
 
        ServerName office.domaine.fr                                                                                 
        ServerAdmin fate@domaine.fr                                                                                  
 
        LogLevel warn              
        CustomLog ${APACHE_LOG_DIR}/office.access.log combined                                                        
        ErrorLog ${APACHE_LOG_DIR}/office.error.log
 
        <IfModule mod_ssl.c>                                                                                                                                                                                                                                SSLEngine on                                                                                          
                SSLCertificateFile /etc/letsencrypt/live/domaine.fr/fullchain.pem                                    
                SSLCertificateKeyFile /etc/letsencrypt/live/domaine.fr/privkey.pem                                   
 
                # HSTS (mod_headers is required) (15768000 seconds = 6 months) 
                Header always set Strict-Transport-Security "max-age=15768000"
 
        </IfModule>                                      
 
        # Encoded slashes need to be allowed       
        AllowEncodedSlashes NoDecode
 
        # Container uses a unique non-signed certificate
        SSLProxyEngine On                                                                                             
        SSLProxyVerify None                        
        SSLProxyCheckPeerCN On                                                                                                                                                                                                              
        SSLProxyCheckPeerName On
 
        # keep the host   
        ProxyPreserveHost On      
 
        # static html, js, images, etc. served from coolwsd                                                           
        # browser is the client part of LibreOffice Online
        ProxyPass           /browser https://localhost:9980/browser retry=0                                           
        ProxyPassReverse    /browser https://localhost:9980/browser       
 
        # WOPI discovery URL                               
        ProxyPass           /hosting/discovery https://localhost:9980/hosting/discovery retry=0
        ProxyPassReverse    /hosting/discovery https://localhost:9980/hosting/discovery                               
 
        # Main websocket                                                                                              
        ProxyPassMatch "/cool/(.*)/ws$" wss://localhost:9980/cool/$1/ws nocanon                                                                                                                                                                                                                                                                                   
        # Admin Console websocket                                                                                     
        ProxyPass   /cool/adminws wss://localhost:9980/cool/adminws                                                   
 
        # Download as, Fullscreen presentation and Image upload operations     
        ProxyPass           /cool https://localhost:9980/cool                 
        ProxyPassReverse    /cool https://localhost:9980/cool
 
        # Endpoint with information about availability of various features
        ProxyPass           /hosting/capabilities https://localhost:9980/hosting/capabilities retry=0
        ProxyPassReverse    /hosting/capabilities https://localhost:9980/hosting/capabilities
 
</VirtualHost>                                          
 
# modern configuration, tweak to your needs        
SSLProtocol             all -SSLv3 -TLSv1 -TLSv1.1                                                                                                                                                                                          
SSLCipherSuite          ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCMSHA256:ECDHEECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
SSLHonorCipherOrder     on
SSLCompression          off       
SSLSessionTickets       off                                
 
# OCSP Stapling, only in httpsd 2.3.3 and later           
SSLUseStapling          on                                                                                            
SSLStaplingResponderTimeout 5                                                                                         
SSLStaplingReturnResponderErrors off                       
SSLStaplingCache        shmcb:/var/run/ocsp(128000)

Activez le fichier de configuration (modifiez le nom de domaine) :

sudo a2ensite office.domaine.fr.conf

Redémarrez Apache2 :

sudo systemctl restart apache2.service

Téléchargez la dernière version de Nextcloud :

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

Mettez l'utilisateur www-data propriétaire du répertoire nextcloud :

sudo chown -R www-data:www-data nextcloud

Lancez MySQL :

sudo mysql -u root

Créez la base de données :

CREATE DATABASE nextcloud;

Créez l'utilisateur (changez le mot de passe) :

CREATE USER nextcloud@localhost IDENTIFIED BY 'motdepasse';

Donnez les droits à l'utilisateur sur la base de données nextcloud :

GRANT ALL PRIVILEGES ON nextcloud.* TO nextcloud@localhost;

Rechargez les privilèges :

FLUSH PRIVILEGES;

Quittez MySQL :

exit

Créez le fichier de configuration Apache2 (remplacez le nom de domaine) :

sudo nano /etc/apache2/sites-available/nextcloud.domaine.fr.conf

Ajoutez-y les lignes suivantes (modifiez le nom de domaine et le chemin des certificats SSL) :

<VirtualHost *:80>
 
        DocumentRoot /var/www/nextcloud/
 
        ServerName nextcloud.domaine.fr
        ServerAdmin fate@domaine.fr
 
        Redirect / https://nextcloud.domaine.fr/
 
</VirtualHost>
 
 
<VirtualHost *:443>
 
        DocumentRoot /var/www/nextcloud/
 
        ServerName nextcloud.domaine.fr
        ServerAdmin fate@domaine.fr
 
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/nextcloud.access.log combined
        ErrorLog ${APACHE_LOG_DIR}/nextcloud.error.log
 
        <IfModule mod_ssl.c>
                SSLEngine on
                SSLCertificateFile /etc/letsencrypt/live/domaine.fr/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/domaine.fr/privkey.pem
                #Header set Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self'; media-src 'self'; child-src 'self'; object-src 'self'; form-action 'self'; img-src 'self' * data:"
        </IfModule>
 
 
        <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>
 
# modern configuration, tweak to your needs
SSLProtocol             all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite          ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
SSLHonorCipherOrder     on
SSLCompression          off
SSLSessionTickets       off
 
# OCSP Stapling, only in httpd 2.3.3 and later
SSLUseStapling          on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache        shmcb:/var/run/ocsp(128000)

Activez le fichier de configuration (modifiez le nom de domaine) :

sudo a2ensite nextcloud.domaine.fr.conf

Redémarrez Apache2 :

sudo systemctl restart apache2.service

Allez à l'adresse https://nextcloud.domaine.fr :

Choisissez un nom d'utilisateur et un mot de passe pour le compte administrateur. Cliquez sur “Stockage & base de données” puis sur “MySQL/MariaDB” et remplir les champs comme suit (remplacez motdepasse par le mot de passe que vous avez choisi lors de la création de la base de données) :

Cliquez sur “Installer”.

Sur l'écran suivant, cliquez sur “Annuler”. Je préfère installer uniquement les applications dont j'ai besoin.

Nextcloud est maintenant installé. Passons à l'installation de Collabora Online.

Ouvrez le fichier de config de Nextcloud :

sudo nano /var/www/nextcloud/config/config.php

Ajoutez la ligne suivante pour activer le cache via APCu :

'memcache.local' => '\OC\Memcache\APCu',

APCu

APCu is a data cache, and it is available in most Linux distributions. On Red Hat/CentOS/Fedora systems install php-pecl-apcu. On Debian/Ubuntu/Mint systems install php-apcu.

After restarting your Web server, add this line to your config.php file:

'memcache.local' ⇒ '\OC\Memcache\APCu',

Sources : https://www.howtoforge.com/how-to-install-nextcloud-on-debian-11/ https://docs.nextcloud.com/server/latest/admin_manual/

Vous pourriez laisser un commentaire si vous étiez connecté.
  • serveur_hebergement/nextcloud_et_collabora_online.1664903438.txt.gz
  • Dernière modification : 2023/08/08 14:01
  • (modification externe)