Outils pour utilisateurs

Outils du site


nextcloud_dans_lxc

Ceci est une ancienne révision du document !


Nextcloud dans un conteneur LXC

Article détaillé sur l'installation de nextcloud 17 dans un conteneur lxc.

Je pars d'une Debian Buster.

# lxc-create -t download -n nextcloud -- --dist debian --release buster --arch amd64

Configuration (on rajoute le démarrage automatique) :

# vim /var/lib/lxc/nextcloud/config
# cat /var/lib/lxc/nextcloud/config
lxc.start.auto = 1
 
# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = linux64
 
# Container specific configuration
lxc.rootfs.path = dir:/var/lib/lxc/nextcloud/rootfs
lxc.uts.name = nextcloud
 
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:c8:1b:05

Pour l'IP fixe :

# vim /etc/lxc/dnsmasq.conf
(...)
dhcp-host=nextcloud,10.0.3.4

On redémarrer le service :

# systemctl restart lxc-net

Et on démarre le conteneur :

# lxc-start nextcloud
# lxc-ls -f
NAME      STATE   AUTOSTART GROUPS IPV4     IPV6 UNPRIVILEGED 
(...)       
nextcloud RUNNING 1         -      10.0.3.4 -    false

Installation des prérequis

# lxc-attach nextcloud
 
root@nextcloud:/# apt install nginx php-fpm mariadb-server wget curl

Script "setup-nextcloud.php"

root@nextcloud:/# mkdir /var/www/nextcloud
 
root@nextcloud:/# cd /var/www/nextcloud
 
root@nextcloud:/var/www/nextcloud# wget https://download.nextcloud.com/server/installer/setup-nextcloud.php

Il faut changer la version de nextcloud dans le script parce que par défaut elle est encore en 16.0.3 à l'heure où j'écris ces lignes.:wq

root@nextcloud:/var/www/nextcloud# vim setup-nextcloud.php
(...)
// Nextcloud version
define('NC_VERSION', '17.0.0');
(...)
 
root@nextcloud:/var/www/nextcloud# cd ..
 
root@nextcloud:/var/www# chown -R www-data:www-data nextcloud/

Il faut configurer nginx pour qu'il pointe sur ce dossier :

root@nextcloud:/var/www# cat /etc/nginx/sites-enabled/default                                                                                                                                                       
 
server {                                                                                                                                                                                                            
        listen 80 default_server;                                                                                                                                                                                   
 
        root /var/www/nextcloud;
 
        # Add index.php to the list if you are using PHP
        index index.html index.htm index.php;
 
        server_name _;
 
        location / {
                try_files $uri $uri/ =404;
        }
 
        # pass PHP scripts to FastCGI server
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
 
                fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        }
}
root@nextcloud:/var/www# systemctl reload nginx

“Plus qu'à” se rendre sur l'url qu'on a fait pointer sur le conteneur : https:(…)/setup-nextcloud.php Le script renseigne quelques dépendances manquantes. <code> Dependencies not found. The following PHP modules are required to use Nextcloud: zip dom XMLWriter libxml mb multibyte GD SimpleXML curl </code> À installer : <code bash> root@nextcloud:/var/www# apt install php-zip root@nextcloud:/var/www# apt install php-xml root@nextcloud:/var/www# apt install php-curl root@nextcloud:/var/www# apt install php-mbstring </code>

nextcloud_dans_lxc.1571673470.txt.gz · Dernière modification : 2020/08/09 12:59 (modification externe)