Tuesday, August 23, 2011

How to install XMPP (Jabber) IM server in Debian

XMPP is an open-standard communications protocol for message-oriented middleware based on XML (originally named Jabber). Prerequisites:
  • XMPP domain: dev.local
  • ejabberd server name: im1.dev.local
  • Administrative account: admin@dev.local
In order to install the ejabberd IM server in Debian:
apt-get -y install ejabberd
Add administrative account (user, host, password):
ejabberdctl register admin dev.local P@ssw0rd


You will need a certificate file for your domain. While obtaining self signed certificate, please ensure:
  1. Common Name is the XMPP domain name, e.g. dev.local.
  2. Resulting pem file has both key and certificate
Take a look how to can create a self signed certificate here and add it to trusted certificates here. All configuration is stored in /etc/ejabberd/ejabberd.cfg file.
%% Admin user
{acl, admin, {user, "", "dev.local"}}.

%% Hostname (The list of domains we are going to serve)
{hosts, ["dev.local"]}.


%% domain_certfile: Specify a different certificate for 
%% each served hostname    .
{domain_certfile, "dev.local", "/etc/ejabberd/dev.local.pem"}.


%% To enable in-band registration, replace 'deny' with 
%% 'allow'. This let users create IM account from theirs
%% client applications.
{access, register, [{allow, all}]}.

XMPP DNS Discovery

You need to add the following records to your dns server:
$ORIGIN _tcp.dev.local.
$TTL 900    ; 15 minutes
_jabber         SRV 5 0 5269 im1.dev.local.
_xmpp-client    SRV 5 0 5222 im1.dev.local.
_xmpp-server    SRV 5 0 5269 im1.dev.local.
If you are editing zone of your dynamic dns server consider have a look here.