XMPP with ejabberd

When I wanted to first install a jabber/xmpp server I started looking around and spent most of my time trying to figure out which server to install and that kind of discouraged me, as well I could not find any plug and play tutorial to get started, so I hope this compilation helps someone. This is tutorial is a quick and basic howto, but should cover all the very basic required stuff to work.

Install ejabberd

This is the tough part (as usual on Debian GNU/Linux): apt-get install ejabberd That being done you can now configure ejabberd


Edit the file /etc/ejabberd/ejabberd.cfg and adjust at least the following (note that lines preceded with a '%%' are comments): %% Hostname {hosts, ["domain.tld"]}. If you would like to have more than one host use the following example: %% Hostname {hosts, ["domain.tld","otherdomain.tld"]}. To add ensure admin privileges for a user: %% Admin user %%{acl, admin, {user, "", "localhost"}}. {acl, admin, {user, "user", "domain.tld"}}. That's it, at least to get something running, you can and should check the config file, there are comments and some are even understandable.

add some actual user(s)

Simply issue the ejabberdctl command (check the man for other usages): ejabberdctl register user domain.tld password This will create your user, in this case: user@domain.tld, with the default configuration the user can (and should) change their password on their own. If you would like to setup your server to be open to "in band" user registration, meaning users can create accounts directly via their IM client, you can change (in ejabberd.cfg):

{access, register, [{deny, all}]}. to {access, register, [{allow, all}]}.

and now, DNS

XMPP follows a similar way of functioning as email, meaning your domain.tld does not need to have the same IP as your Jabber/XMPP server, you will need to add some DNS records to enable users of other nodes to find you, as well for your own users to be able to find the server they should connect to.

An example of Bind configuration, in this case this is the configuration for domain.tld where the server will be located at xmpp.domain.tld:

; protocol and such PRIORITY WEIGHT PORT xmpp server _xmpp-client._tcp IN SRV 10 0 5222 xmpp _xmpp-server._tcp IN SRV 10 0 5269 xmpp _jabber._tcp IN SRV 10 0 5269 xmpp

Yes, you can change the ports of your server (client and server ports) and change them in the DNS and bam, that will tell everyone where to go. Priority and weight are things that are useless in my case, but in short it is like with MX priorities, but there are 2 levels here. As you have noticed there are no dots at the end of each name, that means it is relative to the zone this file belongs to, if you are configuring a different zone, for example the server is on xmpp.domain.tld and it will host foobar.org, you can add something like this in the foobar.org zone file:

; protocol and such PRIO WEIGHT PORT xmpp server _xmpp-client._tcp IN SRV 10 0 5222 xmpp.domain.tld. _xmpp-server._tcp IN SRV 10 0 5269 xmpp.domain.tld. _jabber._tcp IN SRV 10 0 5269 xmpp.domain.tld.

Now you can connect to your server simply by using the credentials:


Indeed the correct host (xmpp.domain.tld.) and port of the domain will be found via DNS. That's all.

Oh, just one more thing, the port 5280 is by default open for admins to connect and do some admin stuff. There could be other things to be done here (of course there are), so if you figure it out before me let me know. . : ]