box.matto.nl

home/

Ejabberd on Raspberry Pi with Raspbian Jessie

Last edited

Jabber for really safe communication

There are some benefits on using Jabber as your instant message protocol:

  • Jabber is decentralised (everyone can run a Jabber server, there is no central authority that controls all Jabber communication).
  • Jabber can be used with PGP or GnuPG for really safe encrypted messaging
  • There are several open and free servers and several open and free clients available.

Raspbian on Raspberry Pi

The Raspberry Pi is a very cheap small board with a 700 MHz Arm11 SoC. Buy only the B-model, because this one has a network interface. The A-model comes without network, which makes it much less fun and useable.

Raspbian is an operating system based on Debian that is ptimized for the Raspberry Pi hardware.

There are several Raspbian images available, I choose the Raspbian Jessie Lite, this is a minimal image based on Debian Jessie.

After download and dd the image to a SD-card we can boot the system.

Remove systemd

The first thing to do, is to remove systemd.

Systemd has no place on a Unix-like system.

You can follow the steps on the without-systemd.org wiki.

Install ejabberd

First step is to apt-get install it:

apt-get install ejabberd

This will result in a list of quite some packages to be installed, just say yes and have a cup of coffee or tea.

In the end you will run is some chicken-or-egg problem, ejabberd-contrib will not finish its install before ejabberd is configured.

ejabberd configuration

Previous versions for Debian / Raspbian came with a ejabberd.cfg, but Jessie comes with a ejabberd.yml in /etc/ejabberd.

You have to set your own hostname (fqdn) and the admin-user, but most importantly you have to change the configuration from ipv6 to ipv4.

You can raise the debug-level from 4 to 5 in order to get more debug-information in the logfile. This debug-level is in the top part of the yml-file.

ejabberd.yml and ipv4

Change every line that contains

ip: "::"

into

ip: "0.0.0.0"

To be sure, I also uncommented the lines:

outgoing_s2s_families:
   - ipv4

Setup hostname in ejabberd.yml

Change the lines:

hosts:
  - "localhost"

into

hosts:
  - "jabber.example.com"
  - "localhost"

where jabber.example.com is your own sub-domain for your jabber-server and your domainname.

Next, search for the fqdn line in a comment block and insert the following line below it:

fqdn: "jabber.example.com"

Open a second ssh-session and as root, do

tail -f /var/log/ejabberd/ejabberd.log

After this, in the first ssh-session restart ejabberd with

/etc/init.d/ejabberd restart

(Remember we removed systemd.)

In the screen with the tail -f command, you can now follow the messages of ejabberd. When everty thing goes as expected, you can stop the tail -f with Ctrl-C.

Now, you have to add some users with

ejabberdctl register myuser jabber.example.com mypassword

(Change myuser into the required username, mypassword with the preferred password :)

After this, your Raspberry Pi works as a Jabber server :)