I had an old laptop that I decided would make a good toy for playing around with some lightweight server applications. It was a great candidate for several reasons. For one, I’m not using it for something else. Second, it was free. Third, it has a built in battery backup. Seemed like a win-win for me.
I’ve mentioned before that I am a member of SDF, the Super Dimensional Fortress (sdf.org), a free to the community Unix server that allows remote log in and numerous other goodies. Among those extras is the free jabber (XMPP) service for members. It’s really great, especially for free, but on several occaisions, it has been down for maintenance when I was waiting to receive a message to someone. That is a bit annoying. Obviously, server maintenance needs to happen, and I am really thankful to sdf.org for providing the service. I was just thinking that this would be a good excuse to try setting up my very own XMPP server.
Thus enter ejabberd. Ejabberd is an open source XMPP server that is available on most GNU/Linux distributions, including Debian Wheezy, which was already on my laptop. I looked up several tutorials on-line, and they all seemed to indicate that it would be super easy to set up, and I could get it up and running in a few minutes.
Two days latter…..
I finally got it set up and running. No matter which tutorial I followed, none of them worked. It took hours of research (in between being a dad, husband, working person, etc.), but I finally figured out the problem. Not too many people are planning to set up their own XMPP server, and this problem is probably specific to Debian Wheezy, but I figured that I would show you the REAL steps to get this going.
The problem was that after installing ejabberd, even with the default settings, it would say:
starting service: ejabbered………………………………………………………..FAILED.
And there was no rhyme or reason why! I was only able to figure it out by running ejabberd live, so the output came to the terminal, and then I could see the issue.
# apt-get install ejabberd
If you are like me, it will fail after install.
# dpkg-reconfigure ejabberd
Set up your server name, admin, etc.
# ps axc|grep beam
# ps axc|grep epmd
Now kill both of those processes.
# nano /etc/default/ejabberd
Uncomment the ERLANG_NODE=ejabberd line, or add it if it does not exist. Save and exit that file. Not having this line caused my first failure.
Edit your /etc/hosts file to look like this:
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
Essentially, you need to delete any “extra” hosts in the file, just leave the localhost ones. Later, more can be added to the file once ejabberd is running, but for some reason, having extra hosts in this file cause my second failure.
Now you can start ejabberd. I recommend that the first time, you start it “live” so you can see what is happening under the hood:
# /etc/init.d/ejabberd live
But in the future, you can just start it with the usual services tags:
# service ejabberd restart
You should now have a running instance of ejabberd! Of course, now you need to add a user, if you didn’t already. Here is an example:
# ejabberdctl register userName xmppServerAddress.net superSecretPassword
And there we go! At least for me, that was enough to set up a fully functional XMPP server with ejabberd on Debian Wheezy. Of course, this still needs tuning and enabling features like blocking, encryption, etc., but hey, at least now you have something to work with!
Linux – keep it simple.