nextcloud:installation

NextCloud

Installation sur CentOS 7

Pour installer Apache:

yum install httpd

Pour activer le service :

systemctl enable --now httpd

Pour utiliser les dépôts REMI, il faut activer EPEL :

yum install epel-release

Il faut aussi yum-utils:

yum install yum-utils

Pour activer le dépôt REMI pour PHP 7.3 :

yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Les paquets nécessaires à nextcloud :

yum install php73-php-cli php73-php-fpm php73-php-gd php73-php-intl php73-php-pdo php73-php-mbstring php73-php-mysqlnd php73-php-opcache php73-php-pecl-apcu php73-php-pecl-igbinary php73-php-pecl-memcached php73-php-pecl-msgpack php73-php-pecl-mysql php73-php-pecl-zip php73-php-process php73-php-xml

Pour activer le service php-fpm :

systemctl enable --now php73-php-fpm

Activer le service

systemctl enable --now mariadb

Pour créer la base et l'utilisateur pour nextcloud :

mysql> create database nextcloud;
mysql> GRANT ALL ON nextcloud.* TO nextcloud@localhost IDENTIFIED BY 'nextcloud';

Téléchargement de nextcloud :

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

Installation de nextcloud dans /var/www/html/

unzip nextcloud-15.0.7.zip -d /var/www/html

Déplacer tous les fichier de /var/www/html/nextcloud dans /var/www/html (attention il y a 2 fichiers cachés), et donner les bons droits :

chown -R apache. /var/www/html

Il faut autoriser php-fpm à faire des execmem :

setsebool -P httpd_execmem 1

Il faut relancer le service php-fpm :

systemctl restart php73-php-fpm

Le reste concerne les contextes par défaut des fichiers nextcloud, surtout ceux où nextcloud doit pouvoir écrire :

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/3rdparty(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/apps(/.*)?'

S'assurer que les contextes sont appliqués :

restorecon -Rv /var/www/html

Fichier /etc/httpd/conf.d/nextcloud.conf :

<IfModule mod_ssl.c>
<VirtualHost *:443>
SSLEngine on

DocumentRoot /var/www/html/
ErrorLog /var/log/httpd/nextcloud-error.log
CustomLog /var/log/httpd/nextcloud-access.log combined
ServerName cloud.nextcloud.lan
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCACertificateFile /etc/ssl/certs/ca-bundle.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
<Directory /var/www/html/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html
SetEnv HTTP_HOME /var/www/html
</Directory>
<IfModule mod_headers.c>
#Header always set Strict-Transport-Security "max-age=15768000; preload"
#Header set Referrer-Policy "strict-origin-when-cross-origin"
#Header set X-Content-Type-Options "nosniff"
#Header always set X-Frame-Options "SAMEORIGIN"
#Header always set Feature-Policy "accelerometer 'none'; autoplay 'self'; geolocation 'none'; midi 'none'; notifications 'self'; push 'self'; sync-xhr 'self' https://cloud.nextcloud.lan; microphone 'self'; camera 'self'; magnetometer 'none'; gyroscope 'none'; speaker 'self'; vibrate 'self'; fullscreen 'self'; payment 'none'; usb 'none'"
#Header set Content-Security-Policy "child-src 'https://*.nextcloud.lan'"
#Header set Content-Security-Policy: "frame-ancestors https://cloud.nextcloud.lan https://office2.nextcloud.lan http://office2.nextcloud.lan"
#Header set Content-Security-Policy: "frame-src '*'"
</IfModule>
</VirtualHost>
</IfModule>

Redirection des pages php vers les FPM (à intégrer à la conf vhost peut-être), dans /etc/httpd/conf.d/php.conf :

<Files ".user.ini">
    Require all denied
  </Files>

AddType text/html .php

DirectoryIndex index.php

SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

<FilesMatch .php$>
    SetHandler "proxy:fcgi://127.0.0.1:9000"
  </FilesMatch>

Ensuite, voir éventuellement la configuration de collabora.

  • nextcloud/installation.txt
  • Dernière modification : 2019/04/16 07:11
  • de madko