X
    Categories: Tutorials

How to Install Etherpad Lite on Debian Wheezy

In this tutorial, we will show you how to install Etherpad Lite on Debian Wheezy. Etherpad Lite is an Open Source web-based editor providing collaborative editing in real-time, including built-in chat box. This all takes place on one of our Linux VPS hosting plans but it should work just as well on any other Linux installation.

The following command will install all necessary packages

apt-get install gzip git-core curl python libssl-dev pkg-config \
                build-essential python g++ make checkinstall \
                nginx-full mysql-server

 

Next we need to compile and install nodejs

cd /usr/src/
wget http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz && cd node-v*
./configure && checkinstall

When the dialog window opens, enter ‘3’ and remove the “v” in front of the version number.
Install nodejs with the following command

dpkg -i node_*

 

Create a MySQL or a MariaDB database

CREATE DATABASE etherpad CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON etherpad.* TO etherpad@localhost IDENTIFIED BY '__yourPasswd__';
FLUSH PRIVILEGES;
\q

 

Install and configure Etherpad Lite

Go to the directory where you want to install Etherpad Lite and clone the git repository

cd /var/www/
git clone git://github.com/ether/etherpad-lite.git

Edit the configuration file

cd etherpad-lite/
cp settings.json.template settings.json
vim settings.json

and change the following settings:

// change the IP Address
"ip": "127.0.0.1",
// set a session key
"sessionKey" : "rAnD0m5tRIng",
//configure the connection settings
 "dbType" : "mysql",
 "dbSettings" : {
   "user"    : "etherpad",
   "host"    : "localhost",
   "password": "__yourPassword__",
   "database": "etherpad"
 },
// add admin user
"users": {
 "admin": {
 "password": "__yourAdminPassword__",
 "is_admin": true
 }
},

 

Create a system user

adduser --system --home=/var/www/etherpad-lite/ --group etherpad
chown -R etherpad: /var/www/etherpad-lite/

 

Start Etherpad Lite for the first time:

su -c "/var/www/etherpad-lite/bin/run.sh" -s /bin/bash etherpad

If everything is OK, kill all processes belonging to the etherpad user

pkill -u etherpad

 

Create an init script using your favorite editor

#!/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/www/etherpad-lite/etherpad-lite.log"
EPLITE_DIR="/var/www/etherpad-lite"
EPLITE_BIN="bin/safeRun.sh"
USER="etherpad"
GROUP="etherpad"
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
chmod +x /etc/init.d/etherpad-lite
update-rc.d etherpad-lite defaults
/etc/init.d/etherpad-lite start

 

Create a new virtual host (server block)

vim /etc/nginx/sites-available/domain.tld.conf

server {
 listen       80;
 server_name  domain.tld;
   location / {
     proxy_pass        http://localhost:9001/;
     proxy_set_header  Host $host;
     proxy_buffering   off;
   }
 }

ln -s /etc/nginx/sites-available/domain.tld /etc/nginx/sites-enabled/domain.tld
/etc/init.d/nginx restart

In case you are using Apache, you can use the following virtual host directive

vim /etc/apache2/sites-available/domain.tld

<VirtualHost *:80>
    ServerName domain.tld
    ServerSignature Off
    <IfModule mod_proxy.c>
        ProxyVia On
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:9001/
        ProxyPassReverse / http://127.0.0.1:9001/
        ProxyPreserveHost on
        <Proxy *>
            Options FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Proxy>
    </IfModule>
</VirtualHost>

ln -s /etc/apache2/sites-available/domain.tld /etc/apache2/sites-enabled/domain.tld
a2enmod proxy proxy_http
/etc/init.d/apache2 restart

That’s it! You can now access Etherpad Lite from your browser.

Etherpad project homepage on GitHub

 

View Comments

  • Just a note, I think this one has a typo ln -s /etc/nginx/sites-available/domain.tld /etc/nginx/sites-enabled/domain.tld It should be [...]tld.conf in the first instance... I think... Thanks to your tutorial I managed to set up etherpad on raspberry~

  • Thanks ! Very usefull. Don't forget (as I do...) to: 1) name the Apache config file domain.tld.conf (and not domain.tld) 2) enable BOTH proxy and proxy_http modules in Apache : a2enmod proxy proxy_http Sheers

  • Hi, I followed this how-to and works fine except access to etherpad . I have a machine with a lamp and I need connect to etherpad from anywhere ( at work, at school, at girlfriend's house... ) I can connect to etherpad in the host desktop but i cannot connect from another machine at same LAN and much least from outside I always get " Connection refused" error Any suggestion? Thanks in advance

    • Please check if your firewall is blocking the access to your desktop and make sure that the port you are trying to connect to is open. Thanks.

      • Please check if your firewall is blocking the access to your desktop and make sure that the port you are trying to connect to is open. Thanks.

  • Thanks for the tutorial! The bash script could use some improvements; if the server is already stopped, the stop method gets into an infinite loop. Fix: stop() { echo "Stopping $DESC... " if [ -f /var/run/$NAME.pid ]; then 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 else echo "Could not find the etherpad-lite process, maybe it is already stopped?" status fi echo "done" } It is also a good idea to set the ulimit when the process starts: ulimit -n 8192

  • In case of Apache, don't forget to enable the proxy module: a2enmod proxy_module proxy_http_module headers_module deflate_module Have a look here for the different suggested configurations: https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy