Outils pour utilisateurs

Outils du site


nextcloud_dans_lxc

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
nextcloud_dans_lxc [2019/10/21 16:15] – [Script "setup-nextcloud.php"] simonnextcloud_dans_lxc [Date inconnue] (Version actuelle) – supprimée - modification externe (Date inconnue) 127.0.0.1
Ligne 1: Ligne 1:
-====== Nextcloud dans un conteneur LXC ====== 
-Article détaillé sur l'installation de [[nextcloud]] 17 dans un conteneur [[lxc]].  
  
-Je pars d'une [[Debian]] Buster. 
-<code bash> 
-# lxc-create -t download -n nextcloud -- --dist debian --release buster --arch amd64 
-</code> 
- 
-Configuration (on rajoute le démarrage automatique) :  
-<code bash> 
-# 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 
-</code> 
- 
-Pour l'[[https://simonlefort.be/wiki/doku.php?id=lxc#ip_statique_dhcp|IP fixe]] :  
-<code bash> 
-# vim /etc/lxc/dnsmasq.conf 
-(...) 
-dhcp-host=nextcloud,10.0.3.4 
-</code> 
- 
-On redémarrer le service :  
-<code bash> 
-# systemctl restart lxc-net 
-</code> 
- 
-Et on démarre le conteneur :  
-<code bash> 
-# lxc-start nextcloud 
-# lxc-ls -f 
-NAME      STATE   AUTOSTART GROUPS IPV4     IPV6 UNPRIVILEGED  
-(...)        
-nextcloud RUNNING 1              10.0.3.4 -    false 
-</code> 
- 
-===== Installation des prérequis ===== 
-<code bash> 
-# lxc-attach nextcloud 
- 
-root@nextcloud:/# apt install nginx php-fpm mariadb-server wget curl 
-</code> 
- 
-===== Script "setup-nextcloud.php" ===== 
-<code bash> 
-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 
-</code> 
- 
-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. 
-<code bash> 
-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/ 
-</code> 
- 
-Il faut configurer nginx pour qu'il pointe sur ce dossier :  
-<code bash> 
-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; 
-        } 
-} 
-</code> 
- 
-On relance nginx : 
-<code bash> 
-root@nextcloud:/var/www# systemctl reload nginx 
-</code> 
- 
-Il n'y a 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 bash> 
-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 php-xml php-curl php-mbstring php-mysql 
-</code> 
- 
-J'ai eu un problème avec MariaDD qui ne pouvait pas démarrer parce que le service ne pouvait pas écrire dans "ibdata1" : 
-<code bash> 
-root@nextcloud:/var/www# systemctl status mysql                                                                                                                                                                      
-● mariadb.service - MariaDB 10.3.17 database server                                                                                                                                                                  
-   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)                                                                                                                             
-   Active: failed (Result: exit-code) since Mon 2019-10-21 16:06:27 UTC; 3min 20s ago                                                                                                                                
-     Docs: man:mysqld(8)                                                                                                                                                                                             
-           https://mariadb.com/kb/en/library/systemd/                                                                                                                                                                
-  Process: 11940 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)                                                                                            
-  Process: 11941 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)                                                                                           
-  Process: 11943 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited 
-, status=0/SUCCESS)                                                                                                                                                                                                  
-  Process: 11991 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)                                                                                  
- Main PID: 11991 (code=exited, status=1/FAILURE)                                                                                                                                                                     
-   Status: "MariaDB server is down"                                                                                                                                                                                  
-                                                                                                                                                                                                                     
-Oct 21 16:06:27 nextcloud mysqld[11991]: 2019-10-21 16:06:27 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable                                                                                
-Oct 21 16:06:27 nextcloud mysqld[11991]: 2019-10-21 16:06:27 0 [ERROR] Plugin 'InnoDB' init function returned error.                                                                                                 
-Oct 21 16:06:27 nextcloud mysqld[11991]: 2019-10-21 16:06:27 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.                                                                                      
-Oct 21 16:06:27 nextcloud mysqld[11991]: 2019-10-21 16:06:27 0 [Note] Plugin 'FEEDBACK' is disabled.                                                                                                                 
-Oct 21 16:06:27 nextcloud mysqld[11991]: 2019-10-21 16:06:27 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded                                                                             
-Oct 21 16:06:27 nextcloud mysqld[11991]: 2019-10-21 16:06:27 0 [ERROR] Unknown/unsupported storage engine: InnoDB                                                                                                    
-Oct 21 16:06:27 nextcloud mysqld[11991]: 2019-10-21 16:06:27 0 [ERROR] Aborting 
-(...) 
-</code> 
- 
-Résolution ([[https://askubuntu.com/questions/758898/mysql-wont-start-after-changing-the-datadir-14-04-mysql-5-7/795710#795710|source]]) :  
-<code bash> 
-root@nextcloud:/var/www# chown -R mysql /var/lib/mysql/ 
- 
-root@nextcloud:/var/www# chgrp -R mysql /var/lib/mysql/ 
- 
-root@nextcloud:/var/www# ls -alh /var/lib/mysql/ 
-total 109M 
-drwxr-xr-x  4 mysql mysql 4.0K Oct 19 18:32 . 
-drwxr-xr-x 16 root  root  4.0K Oct 19 18:32 .. 
--rw-r-----  1 mysql mysql  16K Oct 19 18:32 aria_log.00000001 
--rw-r-----  1 mysql mysql   52 Oct 19 18:32 aria_log_control 
--rw-r--r--  1 mysql mysql    0 Oct 19 18:32 debian-10.3.flag 
--rw-r-----  1 mysql mysql  976 Oct 19 18:32 ib_buffer_pool 
--rw-r-----  1 mysql mysql  48M Oct 19 18:32 ib_logfile0 
--rw-r-----  1 mysql mysql  48M Oct 19 18:32 ib_logfile1 
--rw-r-----  1 mysql mysql  12M Oct 19 18:32 ibdata1 
--rw-r-----  1 mysql mysql    0 Oct 19 18:32 multi-master.info 
-drwx------  2 mysql mysql 4.0K Oct 19 18:32 mysql 
--rw-r-----  1 mysql mysql   16 Oct 19 18:32 mysql_upgrade_info 
-drwx------  2 mysql mysql 4.0K Oct 19 18:32 performance_schema 
- 
-root@nextcloud:/var/www# systemctl start mysql 
-root@nextcloud:/var/www# systemctl status mysql 
-</code> 
nextcloud_dans_lxc.1571674545.txt.gz · Dernière modification : 2020/08/09 12:59 (modification externe)