Installing an XMPP server on Debian 7

This guide wil cover installing an XMPP/Jabber server (ejabberd) in Debian 7 (Wheezy). This XMPP daemon supports both c2s and s2s messages. C2s messages are messages from your chat client to the XMPP server. This message wil be delivered to another user that has an account on your XMPP server. If the user is on another domain name ejabberd wil send an s2s message to the other server (called XMPP federation) and the other server delivers the message with c2s messages to that client.

Installing the ejabberd package

This step is pretty easy since ejabberd is in the Debian repository

$ sudo apt-get install ejabberd

Configuring the daemon

The default configuration file for ejabberd is located in /etc/ejabberd/ejabberd.cfg. Some important settings need to be changed to use it as an fully functioning xmpp server. First change the admin user line to your own user and setup the domain info.

%% set the admin username to martijn@brixit.nl
{acl, admin, {user, "martijn", "brixit.nl"}}.
%% add brixit.nl to the domains hosted on this server
{hosts, ["brixit.nl"]}.
%% set the public dns name for this server
{fqdn, "brixit.nl"}.

If you restart the server now it probably works. Run the following commands to restart the daemon and add your account:

$ sudo service ejabberd restart
$ ejabberdctl register martijn brixit.nl 'ThisIsMySecretPassword'

Now you can open the website https://xmpp.net/ and enter your domain to test and configure your chat client to use your server. The only thing the test wil complain about is invalid SSL certificates. On installation the debian installer created a self-signed certificate at /etc/ejabberd/ejabberd.pem. To make your installation complete you should generate an SSL certificate for your server and put it in ejabberd.pem.