[Gandi] [Serveur] [IaaS] Installation de Etherpad dans un conteneur LXC

[Gandi] [Serveur] [IaaS] Installation de Etherpad dans un conteneur LXC.

1/ Connexion au serveur.

➜  ~ ssh admin@46.226.109.238
admin@46.226.109.238's password:
Linux server01lxc 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64
...
admin@server01lxc:~$

2/ Passage vers l’utilisateur ‘root‘.

admin@server01lxc:~$ su
Password:
root@server01lxc:/home/admin#

3/ Copie de la machine virtuelle.

root@server01lxc:/home/admin# lxc-stop -n vm02
root@server01lxc:/home/admin# lxc-copy -n vm02 -N vm02_1
root@server01lxc:/home/admin# lxc-start -n vm02
root@server01lxc:/home/admin# lxc-ls --fancy
NAME   STATE   AUTOSTART GROUPS IPV4      IPV6
vm01   RUNNING 0         -      10.0.3.11 -
vm02   RUNNING 0         -      10.0.3.12 -
vm02_1 STOPPED 0         -      -         -
vm03   RUNNING 0         -      10.0.3.13 -
root@server01lxc:/home/admin#

4/ Règle iptable.

root@server01lxc:/home/admin# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 9001 -j DNAT --to-destination 10.0.3.12:9001

5/ Connexion au conteneur.

root@server01lxc:/home/admin# lxc-attach -n vm02
root@vm02:/#

6/ Mise-à-jour du système d’exploitation.

root@vm02:/# apt-get update
root@vm02:/# apt-get upgrade
root@vm02:/# apt-get install vim mc screen curl wget

7/ Installation des paquets de développement.

root@vm02:/# apt-get install build-essential git

8/ Création de l’utilisateur ‘etherpad‘.

root@vm02:/# adduser etherpad
root@vm02:/# su etherpad
etherpad@vm02:/root$ cd
etherpad@vm02:~$ pwd
/home/etherpad
etherpad@vm02:~$

9/ Téléchargement du code source de nvm.

etherpad@vm02:~$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
etherpad@vm02:~$ source .bashrc

10/ Installation de Nodejs.

– Liste des versions de nodejs :

etherpad@vm02:~$ nvm ls-remote
...
         v8.9.4   (Latest LTS: Carbon)
...

– Installation de nodejs :

etherpad@vm02:~$ nvm install 8.9.2
...
Checksums matched!
Now using node v8.9.2 (npm v5.5.1)
Creating default alias: default -> 8.9.2 (-> v8.9.2)

– Activer nodejs :

etherpad@vm02:~$ nvm use 8.9.2
Now using node v8.9.2 (npm v5.5.1)

– Vérification :

etherpad@vm02:~$ node -v
v8.9.2
etherpad@vm02:~$ npm -v
5.5.1

11/ Téléchargement du code source de etherpad.

etherpad@vm02:~$ git clone https://github.com/ether/etherpad-lite.git

12/ Installation des dépendances.

etherpad@vm02:~$ cd etherpad-lite/
etherpad@vm02:~/etherpad-lite$ ./bin/installDeps.sh

13/ Fichier de configuration.

Ouvrir :

/home/etherpad/etherpad-lite/settings.json

Chercher :

/*
"users": {
  "admin": {
    "password": "changeme1",
    "is_admin": true
  },
  "user": {
    "password": "changeme1",
    "is_admin": false
  }
},
*/

Remplacer par :

"users": {
  "admin": {
    "password": "nøtreNouveaùMotDePasse",
    "is_admin": true
  }
},

14/ Lancement du serveur.

etherpad@vm02:~/etherpad-lite$ ./bin/run.sh

15/ Test.

http://46.226.109.238:9001/

16/ Installation de MySQL.

root@vm02:/# apt-get install mysql-server mysql-client

17/ Installation de la base de données.

– Connexion au serveur MySql :

root@vm02:/# mysql -u root -p
Enter password:
...
MariaDB [(none)]>

– Création de la table etherpad :

MariaDB [(none)]> CREATE DATABASE etherpad CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALTER, CREATE, SELECT, INSERT, UPDATE, DELETE, TRIGGER ON etherpad.* TO etheruser@localhost IDENTIFIED BY 'XXXXXXXX';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit;
Bye
root@vm02:/#

18/ Fichier de configuration.

root@vm02:/# su etherpad
etherpad@vm02:/$ cd
etherpad@vm02:~$ cd etherpad-lite/
etherpad@vm02:~/etherpad-lite$

Ouvrir :

/home/etherpad/etherpad-lite/settings.json

Chercher :

  "dbType" : "dirty",
  //the database specific settings
  "dbSettings" : {
                   "filename" : "var/dirty.db"
                 },
  /* mysql configuration
   "dbType" : "mysql",
   "dbSettings" : {
                    "user"    : "etherpad_lite",
                    "host"    : "localhost",
                    "password": "XXXXXXXXXX",
                    "database": "etherpad_lite"
                  },
   */

Remplacer par :

  /* "dbType" : "dirty",
  //the database specific settings
  "dbSettings" : {
                   "filename" : "var/dirty.db"
                 },
  */
  // mysql configuration
   "dbType" : "mysql",
   "dbSettings" : {
                    "user"    : "etheruser",
                    "host"    : "localhost",
                    "password": "XXXXXXXXXX",
                    "database": "etherpad"
                  },

19/ Redémarrer le serveur.

etherpad@vm02:~/etherpad-lite$ ./bin/run.sh

20/ Altérer les tables.

etherpad@vm02:~/etherpad-lite$ mysql -u etheruser -p
Enter password:
...
MariaDB [(none)]>
MariaDB [(none)]> ALTER DATABASE `etherpad` CHARACTER SET utf8 COLLATE utf8_bin;
MariaDB [(none)]> USE `etherpad`;
MariaDB [etherpad]> ALTER TABLE `store` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
MariaDB [etherpad]> exit

21/ Redémarrer le serveur.

etherpad@vm02:~/etherpad-lite$ ./bin/run.sh

22/ Test.

http://46.226.109.238:9001/

23/ Lancer le serveur sous screen.

– Lancer screen :

etherpad@vm02:~/etherpad-lite$ exit
root@vm02:/# script /dev/null
Script started, file is /dev/null
root@vm02:/# screen

– Lancement du serveur :

root@vm02:/# su etherpad
etherpad@vm02:/$ cd
etherpad@vm02:~$ cd etherpad-lite/
etherpad@vm02:~/etherpad-lite$ ./bin/run.sh

– Détacher le screen :
[Ctrl] + [A] [D]
– Quitter screen :

root@vm02:/# exit
Script done, file is /dev/null
root@vm02:/#
root@vm02:/# exit
root@server01lxc:/home/admin#

24/ Liens.

https://bbs-ilias.de/info/goto.php?target=blog_62_16&client_id=info
https://wiki.koumbit.net/PadConfiguration
https://stackoverflow.com/questions/39471261/must-be-connected-to-a-terminal-error-with-screen-x-command-on-a-linux-contai
https://framacloud.org/fr/cultiver-son-jardin/etherpad.html