Compiling ejabberd for Ubuntu Lucid server

But there’s an apt package

Yes. But it kind of sucks. I had problems with the bundled init.d script. It tries to start ejabberd as the user “ejabberd” but something goes awry. It seems to start but I’m then unable to connect to that node using the ejabberdctl command. Maybe its just me? meh.

What about the Process One binary installer?

That works if you’re content with running ejabberd under root user or whatever user you installed ejabberd as. If installed as a user other than root you’ll have a problem trying to start ejabberd with any user other than root. Thats because the .erlang-cookie file is expected in the $HOME directory of the user starting ejabberd. Its a file permissions nightmare. bleh.

Running ejabberd under a safe(r) user account

Install dependencies

Lets use apt to install the dependencies for ejabberd. Its just a shortcut to getting the dependencies. You can do it the hard way. If you want

apt-get build-dep ejabberd

Download ejabberd source

We’ll get the source for ejabberd 2.1.3 the lazy way too. You could of course clone the git repo and checkout version 2.1.3 but a clone can take a while over a slow-w-w-w connection.

wget http://github.com/processone/ejabberd/tarball/v2.1.3 && tar -xzf processone-ejabberd-v2.1.3-0-g962b66b.tar.gz && cd processone-ejabberd-84987d6/src

Creating a user to run ejabberd

This is important. We’ll need it for the ./configure command coming later


sudo groupadd --gid 107 ejabberd
sudo adduser --system --no-create-home --uid 107 --gid 107 --disabled-password --disabled-login ejabberd

Note: I’ve used the same uid and gid in the line above. uid 107 may already be in use on your system. You can check for uid‘s already in use by grep’ing your /etc/passwd. Ensure the numeric value for uid and gid is the same as shown above. I’m not so sure the next step will work as intended if its not.

Configure (with something special), make, make install

Here’s the part that really matters

cd /path-to-untarred-ejabberd/src
sudo ./configure --prefix /usr/local/ejabberd-2.1.3/ --enable-user=ejabberd --enable-odbc --enable-full-xml
sudo make
sudo make install

There are two other options available for the ./configure script. Check this out. You may want MSSQL Server support or whatever. The only must-have for the purpose of this install method is the –enable-user option. The rest can be changed to your liking

The –enable-user option allows ejabberd to be started by root and/or the user account specified. Permissions will be set accordingly by the install process

A sane init.d script

ejabberd is now installed but you’d like it to automatically be started on system startup? You’ll need an init.d script for that and I have one for you.

I mauled the init.d script shipped with Process One‘s binary installer to my liking. Download revised init.d script from github. Place it in your /etc/init.d/ folder naturally. It works. Trust me already

Make ejabberdctl executable from anywhere

This is a lazy hack you could do it “right” by modifying your $PATH env variable in /etc/profile for all users or whatever

sudo ln -s /usr/local/ejabberd-2.1.3/sbin/ejabberdctl /usr/sbin/ejabberdctl

Starting/stopping ejabberd

The ejabberd process will automagically be daemonized erlang-style and the ownership of the ejabberd process is handed over to the ejabberd user we created earlier

root@blahblah:~# /etc/init.d/ejabberd start
Starting ejabberd...
done.

ps aux | grep ejabberd
ejabberd 21200 0.0 19.5 207044 49004 ? Sl 18:07 0:01 /usr/lib/erlang/erts-5.7.4/bin/beam.smp -K true -P 250000 -- -root /usr/lib/erlang -progname erl -- -home /usr/local/ejabberd-2.1.3/var/lib/ejabberd -- -sname ejabberd@localhost -noshell -noinput -noshell -noinput -pa /usr/local/ejabberd-2.1.3/lib/ejabberd/ebin -mnesia dir "/usr/local/ejabberd-2.1.3/var/lib/ejabberd" -s ejabberd -sasl sasl_error_logger {file,"/usr/local/ejabberd-2.1.3/var/log/ejabberd/erlang.log"} -smp auto start
root 21257 0.0 0.2 6152 660 pts/5 S+ 18:37 0:00 grep --color=auto ejabberd

Confirmation that the ejabberd node has been started

root@blahblah:~# ejabberdctl status
The node ejabberd@localhost is started with status: started
ejabberd 2.1.3 is running in that node

And that is all. You could do the same for ejabberd 2.1.4 (I reckon). I didn’t install 2.1.4 because its a little too bleeding edge but you decide for yourself

Published in: on June 12, 2010 at 8:54 pm  Comments (1)  
Tags: , ,

VirtualBox’ing Ubuntu Linux

If you’re expecting a long hack about how to get it working sorry you won’t find it here. Ubuntu just works in VirtualBox except for one not so obvious error message on first boot.

I couldn’t get a screenshot for some reason but the error message you will get on first boot of any ubuntu distro (desktop or server) in VirtualBox is:


Starting up ...
This kernel requires the following features not present on the CPU:
0:6
Unable o boot - please use a kernel appropriate for your CPU.

Huh? Yeah me too. I’ve encountered this issue before I just forgot the fix so I had to google it (again). The fix is:

  1. Power-off or shutdown the running virtual machine instance
  2. Select the “Settings” menu option from the context-menu on your VM instance (mine is called hardy lts in the screenshot)
  3. Then from the General tab pane select “Advanced” tab pane
  4. Enable PAE/NX

VirtualBox fixer upper

That’s it! You now have a useable ubuntu virtual machine running in OS X. yay. This is listed as a “Known Issue” on the ubuntu wiki

Disclaimer: Steps may vary on your guest OS. eg. it might require 50+ clicks and a cold boot when using winblows :P

Published in: on February 9, 2009 at 10:24 pm  Comments (2)  
Tags: , ,