Compiling ejabberd on Ubuntu

Following on my previous post, the next stage is to add an XMPP server to the setup, in the form of ejabberd. As before, all the commands given are executing from our home directory, and in every case ubuntu01 should be substituted with the hostname (fully qualified) of the machine.

Before we start, a couple more pre-requisites in addition to the stuff we installed last time:

sudo apt-get install subversion
sudo apt-get install libexpat1-dev

The next step is getting and compiling ejabberd. For reproducability, I’m grabbing a specific revision of the source from SVN, which at the time of writing is the current one anyway.

svn co -r 905 http://svn.process-one.net/ejabberd/trunk
mv trunk ejabberd
cd ejabberd/src
./configure
make
sudo make install
cd ../..

Generating and installing an SSL certificate:

openssl req -new -x509 -newkey rsa:1024 -days 3650 \
   -keyout privkey.pem -out server.pem
openssl rsa -in privkey.pem -out privkey.pem
cat privkey.pem >> server.pem
rm privkey.pem
sudo mv server.pem /etc/ejabberd/ssl.pem

Now we can configure and starting ejabberd. Before doing this, some of tinkering is required in /sbin/ejabberdctl to account for some issues in the Makefile. Specifically there is some confusion with the ROOTDIR variable, which I just removed completely. Some editing of ejabberd.cfg in /etc/ejabberd is also required, mainly to set the hostname and configure the S2S settings. Once this is done:

sudo ejabberdctl start
ejabberdctl register admin ubuntu01 password

Obviously replace password with an appropriate password. Next, edit ejabberd.cfg again and add a line to grant admin rights to the new admin user (it’s documented in the file), and restart ejabberd to allow the change to take effect:

ejabberdctl restart

You can now test the web interface by going to http://ubuntu01:5280/admin in a browser.

  1. Ciaran’s avatar

    I glossed over the ejabberdctl issue a bit. In more detail:

    1. Change ROOTDIR=@prefix@ to ROOTDIR=
    2. Below that, add EBIN=/var/lib/ejabberd/ebin
    3. Replace the three occurrences of $ROOTDIR/src with $EBIN
    4. Change $NODE to the real hostname, without the domain (but use the fully-qualifed version in ejabberd.cfg)

    Reply

  2. CiaranG’s avatar

    The ejabberdctl problems mentioned above are now reported as being fixed in svn revision 951, although I haven’t tried it myself yet. See http://www.jabber.ru/bugzilla/show_bug.cgi?id=372

    Reply

  3. Matt’s avatar

    FYI – I’m trying to run these instructions with the latest version of trunk and I’m getting the following error when i ./configure:

    ./conftest.erl:6: can’t find include lib “ssl/include/ssl_pkix.hrl”
    configure: error: could not compile sample program

    I’m trying to find a fix and I’ll update you if I can find anything.

    Reply

  4. Matt’s avatar

    I think I was missing some ejabberd libraries. Installing these packages fixed it:

    sudo apt-get install erlang-base erlang-nox erlang-dev build-essential libssl-dev libexpat1-dev

    Reply

  5. Jason’s avatar

    Thanks Matt

    Reply

  6. Anonymous’s avatar

    Thanks it worked for me

    Reply

Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">