Running a Jabber server under Debian with eJabberd

I like to run my own jabber server, so that I can be contacted as Also, I’m a sucker for punishment. I’ve run serveral different Jabber servers over the last year or so, and yesterday I started toying with ejabberd. It was probably the easiest to set up of any of the servers I’ve tried, and I recommend it.

I’m running Debian etch, and installing the daemon was a matter of:

sudo apt-get install ejabberd

Once installed, edit /etc/ejabberd/ejabberd.cfg. A ‘%’ at the beginning of a line is a comment, and lines finish with a ‘.’ character. This config file is read only once, and the settings are put into the ejabbed server database on startup. Unfortunately, that’s probably already happened, so uncomment the override_acls. directive – this makes the server re-read the ACL settings from this file on next startup.

I’ll assume that you own the ‘’ domain and want the JID ‘’. Uncomment the line below ‘%% Admin user’. It wants to be something like

%% Admin user
{acl, admin, {user, "user", ""}}.

Change the line below ‘%% Hostname’ to set the hostname of the server:

%% Hostname
{hosts, [""]}.

You may want to look through the rest of the settings. But don’t bother, they’re all very boring. Now restart the server, to pick up the new settings:

sudo ejabberdctl restart

ejabberdctl can also register your admin / jabber user if you’ve turned off anonymous registration:

sudo ejabberdctl register user <password>

Right, you’re done. Assuming that the DNS A record for resolves to the machine you’ve been playing with (it doesn’t have to, see below), you now have a Jabber server with an admin user. You can visit to administer your server, but there’s not a huge amount to do there.

DNS SRV records

If the A record for doesn’t resolve to your server you can still run a server for by pointing DNS SRV records to your server. In fact, you should do this anyway, in the same way that your email will arrive if the A record for your domain points to the mail server, but MX records are still a good idea.

Assuming your Jabber server runs on a machine called, you’ll want the following scary DNS records:

_xmpp-client._tcp 900 IN SRV 5 0 5222
_xmpp-server._tcp 900 IN SRV 5 0 5269
_jabber._tcp      900 IN SRV 5 0 5269

You can check that they’re been set properly using this excellent tool, but it’ll probably take a while for the DNS updates to propagate. If you have the dig command line tool, you can also try

dig -t srv

to ask your local DNS server for one of the SRV records.


You don’t have to use ejabberd. Viable alternatives are:

  • djabberd – lovely if you know Perl and want to extend/hack on a Jabber server. Unfortunately it’s somewhat tricky to configure out of the box, isn’t in Debian, and needs various things checked out from subversion repositories if you want to do esoteric things like preserve your friends roster across daemon restarts or have messages queued when you’re offline.
  • jabberd – I really don’t want to trust an internet server written in C any more. It was the original/first Jabber server, if this makes you approve of it more.
  • Not running your own Jabber server – Very worth considering. Unlike running your own mail server or web server, it’s very hard to change your mind later and have someone else host it. I know of very few 3rd party Jabber hosting providers. Yet. Running your own server is purely a vanity thing, but hosting your own email domain used to be a vanity thing too. However, one company that will host your Jabber server for you is..
  • Google apps for your domain – One of the apps Google provide is a chat (Jabber) server. You can ignore everything else they do and just use the Jabber server part, assuming you have enough DNS access to your domain to point the SRV records to it.