Ejabberd

Ejabberd is a Jabber/XMPP instant messaging server written in erlang.

Installation
You will probably want to review a simple pair of config files before actually installing ejabberd. Namely, these are keywords and use flags configs under. It is possible to set them on a per-package basis as shown.

Sample entry in the use flags config for a build with fairly generic support:

If less support is needed, disabling (-) use flags can be set to override global ones:

Sample entry in the keywords config for an x86 unstable (~) build. (with no version specification)

Now simply emerge the package, and all dependencies should be built automatically.

(The --pretend or --ask flags, aka -p and -a respectively, are helpful to ensure that proper versions are selected, the correct use flags and keywords are enabled, and to review needed dependencies triggered by portage, all pre-install. Here, short options -va are used, i.e. 'ask' with increased verbosity.)

The erlang way
You can edit the directly and it is pretty easy since the distributed config file gives many examples. The syntax is clear, but do mind to provide a dot '.', at the end of every line.

The XML way
It may occur that the configuration file does not parse properly, and crash with errors which unless you know Erlang will make no sense to you. A method was found that uses an XML file parsed through an XSLT processor and spits out a pretty well syntaxed ejabberd.cfg file. The following script will properly parse to write a well-formed, erlang config file.

You will also find two files from the site listed below: xml2erl.xsl, ejabberd.cfg.xml. The writecfg.sh script depends on xsltproc, so you'll need to install it first.

The default configuration settings in the XML file work ok and few changes like setting the correct hostname need to be made to have a working ejabberd server. The syntax of the XML file is also very easy to understand and made changes to.

The config file
You will need to provide your hostname to start with your ejabberd server, and then an admin user e.g, considering you are editing the erlang config file :

If you're using the xml configuration remove the HTML escapes and change the JID to what you created.

Reload the server, and now you have administrative rights which allow you to do special things.

You still need to register your admin user, see next section.

Testing your ejabberd server
This script is used to test changes made to the server configuration.

Starting/Stopping ejabberd
I'm just putting this here for the sake of it. Sometimes the init scripts do not work right properly. Starting ejabberd will work most times, and still give you [ !! ] and be working. Also because of this, issuing a stop will not work either, but instead you will have to kill the process manually.

Registering your users
Once you have the ejabberd running, it is a good idea to create your first user. Connect using your client, I prefer Gaim (now Pidgin), and register a new JID. This will be your first user on the server, and also will be your admin account. Logout, and then stop the server.

Another way to register them is using the control-script provided by gentoo :

SSL and ejabberd
The package now includes a nice script to make certificates, edit the [ req_dn ] section of /etc/jabber/ssl.cnf and then run. When specifying the SSL certificates in the cfg file or xml config, always remember use the full path to the .pem certificate file. eg.

Tips and Tricks and errors
This guide has some creative ways to help you debug ejabberd problems(is this link helpful?), however ejabberd can still be cryptic with its error messages (if it gives any). Here are some other tips that may help debug problems: * Stopping eJabberd ... RPC failed on the node ejabberd@dev: nodedown [ !! ] Simply run it will reset the status of your daemon and you'll be able to reload your config.
 * If you want to use a fully qualified hostname (ie domain.com not just domain) then you have to do more than just change the config file. If you just change the config file and start ejabberd, this won't neccessarily start all of its services (do there should be atleast one running on 5222). To allow for FQDN you have to edit  and  with an editor and change -sname to -name
 * If you change the hostname you must also change ssl.pem if you haven't disabled this, otherwise it will fail when users try to connect and use TLS/SSL.
 * Sometimes after changing the hostname of the machine you run ejabberd on, you will need to remove the contents of.
 * If you get this while trying to stop your ejabberd daemon:
 * This error; can occur after your servers named changed. You have to remove the files in

optional DNS entries
simply cut and paste these into your zone file if you happen to run your own bind domain name server. _xmpp-client._tcp.domain.com. 7200 IN  SRV     10 0 5222 xmpp.domain.com. _xmpp-server._tcp.domain.com. 7200 IN  SRV     10 0 5269 xmpp.domain.com.

External links and documentation

 * Read the documentation in
 * Ejabberd Installation and Operation Guide
 * XML-style configuration for ejabberd.cfg
 * ejabberd SSL configuration error