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

Configuration

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:

    user:
    username
    domain:
    domain.tld
    password:
    password

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. . : ]

comments:
avatar

zupriki

Hi hello i found your posted message ive been looking for a tutorial on how to install a XMPP with ejabberd because i needed it on my beechat in my elggsite. I'm so confused on how to install the ejabberd.

my webserver is a Linux while my desktop computer is Windows,
question is when i download the ejabberd windows version (http://www.process-one.net/en/ejabberd/downloads) , and set it up on my PC after installing it, should I upload it to my Linux webserver.? I know it will not run, but how will get a ejabberd on my webserver?

Sorry I'm so confused with this,
I really appreciate if someone could help me :c
avatar

manu

You are not to upload this on your "web" server, this is software to be installed on A server so that it becomes a Jabber/XMPP server (it can be a webserver at the same time of course).
avatar

slsko - http://up.coxslot.com

Hello. I wanna ask a question concerning the topic (xmpp). What I wanna know is how to develop my own IM app for my social networking site in which once user is logged/ registered, he/she is auto registered on the jabber network. I mean I need something similar to yahoo messenger. Where once a user creates an account on the yahoo website, he/she can then use the IM service without having to do any work around. I'll appreciate any tutorial or address that talks about such issue. Thanks in advance.
avatar

manu - http://manurevah.com

Hi slsko,

Sorry I don't know of any tutorial that can help you achieve that. However, if you are handy with PHP you can always develop the functionality using libxmpp-php.

Good luck.
Leave a comment
You may use the following HTML tags: <p> <a> <strong> <b> <em> <i> <cite> <blockquote> <code> <pre>

Your comments WILL NOT be submitted to any third party (not even for anti spam verification).