====== Installation d'Etherpad-Lite ====== sources : [[http://www.unixgarden.com/index.php/gnu-linux-magazine/node-js-du-javascript-sur-votre-serveur|http://www.unixgarden.com/index.php/gnu-linux-magazine/node-js-du-javascript-sur-votre-serveur]]\\ [[https://github.com/ether/etherpad-lite/wiki|https://github.com/ether/etherpad-lite/wiki]]\\ [[https://help.ubuntu.com/community/Etherpad-liteInstallation|https://help.ubuntu.com/community/Etherpad-liteInstallation]]\\ [[http://jeyg.info/etherpad-lite/|http://jeyg.info/etherpad-lite/]]\\ [[http://geekdefrance.fr/2012/05/09/tuto-installation-dune-solution-de-collaboration-etherpad-lite/|http://geekdefrance.fr/2012/05/09/tuto-installation-dune-solution-de-collaboration-etherpad-lite/]]\\ [[http://ypcs.fi/howto/2012/10/09/nodejs-debian/|http://ypcs.fi/howto/2012/10/09/nodejs-debian/]] ===== Pré requis ===== Installation d'un serveur LAMP sur Debian 7 ===== Installer les dépendances ===== Installer gzip, git, curl, libssl develop libraries, python et gcc aptitude install gzip git-core curl python libssl-dev pkg-config build-essential ===== Installer node.js ===== Télécharger les sources wget http://nodejs.org/dist/latest/node-v0.10.12.tar.gz Extraire l'archive tar zxvf node-v0.10.12.tar.gz Se positionner dans le repertoire décompressé cd node-v0.10.12 Créer le répertoire **node** dans **/opt** mkdir /opt/node Compiler et installer ./configure --prefix=/opt/node make make install echo 'export PATH=$PATH:/opt/node/bin'>> ~/.profile echo 'export NODE_PATH=/opt/node:/opt/node/lib/node_modules'>> ~/.profile source ~/.profile Tester echo "console.log('Hello World');" | node ===== Installer Etherpad-lite ===== Se placer dans le repertoire où l'on desire installer Etherpad Lite cd /usr/share git clone git://github.com/ether/etherpad-lite.git se positionner dans le nouveau répertoire etherpad-lite cd /usr/share/etherpad-lite Installer les dépendances bin/installDeps.sh lancer Etherpad Lite bin/run.sh Se connecter sur [[http://ip_du_serveur:9001|http://ip_du_serveur:9001]]\\ La page de création de Pad doit s'afficher ===== Lancer comme service ===== créer l'utilisateur etherpad-lite useradd etherpad-lite chown -R etherpad-lite /usr/share/etherpad-lite créer le réperetoire pour les logs /var/log/etherpad-lite mkdir /var/log/etherpad-lite ainsi que le fichier log touch /var/log/etherpad-lite/etherpad-lite.log Modifier les droits chown -R etherpad-lite /var/log/etherpad-lite Créer le fichier de rotation des log nano /etc/logrotate.d/etherpad-lite et copier les lignes: /var/log/etherpad-lite/*.log { rotate 4 weekly missingok notifempty compress delaycompress sharedscripts postrotate restart etherpad-lite>/dev/null 2>&1 || true endscript } Créer le script de démarrage /etc/init.d/etherpad-lite nano /etc/init.d/etherpad-lite et copier les lignes: #!/bin/sh ### BEGIN INIT INFO # Provides: etherpad-lite # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts etherpad lite # Description: starts etherpad lite using start-stop-daemon ### END INIT INFO PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin" LOGFILE="/var/log/etherpad-lite/etherpad-lite.log" EPLITE_DIR="/usr/share/etherpad-lite" EPLITE_BIN="bin/safeRun.sh" USER="etherpad-lite" GROUP="etherpad-lite" DESC="Etherpad Lite" NAME="etherpad-lite" set -e . /lib/lsb/init-functions start() { echo "Starting $DESC... " start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE || true echo "done" } #We need this function to ensure the whole process tree will be killed killtree() { local _pid=$1 local _sig=${2-TERM} for _child in $(ps -o pid --no-headers --ppid ${_pid}); do killtree ${_child} ${_sig} done kill -${_sig} ${_pid} } stop() { echo "Stopping $DESC... " while test -d /proc/$(cat /var/run/$NAME.pid); do killtree $(cat /var/run/$NAME.pid) 15 sleep 0.5 done rm /var/run/$NAME.pid echo "done" } status() { status_of_proc -p /var/run/$NAME.pid "" "etherpad-lite" && exit 0 || exit $? } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status ;; *) echo "Usage: $NAME {start|stop|restart|status}">&2 exit 1 ;; esac exit 0 Rendre le script executable chmod +x /etc/init.d/etherpad-lite Activer le script au démarrage update-rc.d etherpad-lite defaults Démarrer le service /etc/init.d/etherpad-lite start ===== Import / Export ===== Installer Abiword aptitude install abiword Dans le fichier **/usr/share/etherpad-lite/settings.json**, remplacer : "abiword" : null, par "abiword" : "/usr/bin/abiword", Redémarrer Etherpad-Lite /etc/init.d/etherpad-lite restart ===== Changer le type de base de données (passage sur MySQL) ===== La base données utilisée par défaut (dirty.db) n'est pas recommandé. Création de la base MySQL mysql -u root -p create database etherpadlite; grant all privileges on etherpadlite.* to etherpadlite@localhost identified by 'mot_de_passe' with grant option; flush privileges; quit Dans le fichier **/usr/share/etherpad-lite/settings.json**, dans la section base de données, remplacer : "dbType" : "dirty", //the database specific settings "dbSettings" : { "filename" : "var/dirty.db" }, par "dbType" : "mysql", "dbSettings" : { "user" : "etherpadlite", "host" : "localhost", "password": "mot_de_passe", "database": "etherpadlite" }, Redémarrer Etherpad Lite /etc/init.d/etherpad-lite restart Se connecter à un pad ([[http://ip_du_serveur:9001|http://ip_du_serveur:9001]]) puis le refermer. Revenir dans MySQL mysql -u root -p ALTER DATABASE `etherpadlite` CHARACTER SET utf8 COLLATE utf8_bin; USE `etherpadlite`; ALTER TABLE `store` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; exit Redémarrer Etherpad Lite /etc/init.d/etherpad-lite restart ===== Plugins ===== ==== Manuellement ==== Se positionner dans le répertoire **/opt/etherpad/local/etherpad/etherpad-lite/** cd /opt/etherpad/local/etherpad/etherpad-lite/ Pour installer un plugin npm install ep_*nom_du_plugin* Pour désinstaller un plugin npm uninstall ep_*nom_du_plugin* Pour mettre à jour un plugin npm install --upgrade ep_*nom_du_plugin* Redémarrer Etherpad Lite /etc/init.d/etherpad-lite restart ==== A partir de l'interface web ==== Pour activer l'intreface web d'administration des plugins, remplacer dans le fichier **/usr/share/etherpad-lite/settings.json** : /* Require authorization by a module, or a user with is_admin set, see below. */ "requireAuthorization": false, /* Users for basic authentication. is_admin = true gives access to /admin. If you do not uncomment this, /admin will not be available! */ /* "users": { "admin": { "password": "changeme1", "is_admin": true }, "user": { "password": "changeme1", "is_admin": false } }, */ par /* Require authorization by a module, or a user with is_admin set, see below. */ "requireAuthorization": true, /* Users for basic authentication. is_admin = true gives access to /admin. If you do not uncomment this, /admin will not be available! */ "users": { "admin": { "password": "mot_de_passe", "is_admin": true }, "user": { "password": "mot_de_passe", "is_admin": false } },