Setting up ejabberd 2.1.x development environment on Ubuntu

apt-get provide a convenient way of installing ejabberd on Ubuntu distributions. However, if you are an erlang developer and looking to write custom ejabberd modules, you might want to install ejabberd from the source code.

Checkout ejabberd source
To start with lets grab the ejabberd 2.1.x branch source code:

  • sudo apt-get install git-core
  • git clone git://git.process-one.net/ejabberd/mainline.git ejabberd
  • cd ejabberd
  • git checkout -b 2.1.x origin/2.1.x
  • cd src

Installing pre-requisites
Lets setup necessary pre-requisites before compiling ejabberd source code:

  • sudo apt-get install build-essential
  • sudo apt-get install automake autoconf
  • sudo apt-get install erlang erlang-manpages
  • sudo apt-get install libexpat1-dev zlib1g-dev libssl-dev

Compiling ejabberd source code
Compiling and installing is dead simple:

  • ./configure
  • make
  • sudo make install

Setting up administration account
By now we have ejabberd server setup on our ubuntu box. Lets setup the admin account:

  • sudo ejabberdctl start
  • sudo ejabberdctl register admin localhost password
  • sudo vim /etc/ejabberd/ejabberd.cfg
  • Add following configurations if not already present:
    {acl, admin, {user, "admin", "localhost"}}.
    {loglevel, 5}. %% Log level while development
  • sudo ejabberdctl restart
  • Visit ejabberd admin panel: http://localhost:5280/admin
  • When prompted enter username as admin@localhost and the password you chose above while registering admin account

Resolving startup errors
You might see a few error reports in logs or elsewhere while starting ejabberd server:

  • /sbin/ejabberdctl: 340: cannot create //var/lock/ejabberdctl/ejabberdctl-1: Directory nonexistent
  • =ERROR REPORT==== 2010-03-29 21:53:03 ===
    C(<0.995.0>:ejabberd_captcha:331) : The option captcha_cmd is not configured, but some module wants to use the CAPTCHA feature.
  • =INFO REPORT==== 2010-03-29 21:53:03 ===
    I(<0.780.0>:ejabberd_rdbms:37) : ejabberd has not been compiled with relational database support. Skipping database startup.

Here is how you can resolve the above errors:

  • sudo mkdir /var/lock/ejabberdctl/ejabberdctl-1
  • Add following line in ejabberd.cfg
    {captcha_cmd, "/lib/ejabberd/priv/bin/captcha.sh"}.

    Replace /lib/ejabberd/priv/bin/captcha.sh with path to /ejabberd/tools/captcha.sh

Getting started with ejabberd development
Below are links to a few useful resources to get you started with erlang and ejabberd module development: