Sunday, 18 January 2009

Installing Erlang

One of my key goals for my experimental cluster is to run (and program) distributed Erlang. The first task is simply to get Erlang installed on the nodes. Unfortunately, there is no CentOS rpm package for Erlang. This is a bit surprising: it means that there is no rpm package for RHEL either. It's not a big problem, we just need to install from the source code.

The first thing to do is download and unpack the source file. Do not do what I did and use File Roller, the GNOME archive manager. If you do you get a make error. Instead just follow the instructions in the readme file:

gunzip -c otp_src_R12B-5.tar.gz tar xf -
zcat otp_src_R12B-5.tar.gz tar xf -

To build Erlang I needed to install the ncurses and OpenSSL development libraries:

yum install ncurses-devel
yum install openssl-devel

That done, Erlang built without any problems. But that's only half the job. The nice thing about running the same OS on both the "host" machine (where the nodes are managed from) and on the nodes themselves, is that you can build software on the host and then just copy it to the nodes. The Perceus user guide states that you should be able to do something like this:

make DESTDIR=/mnt/centos-5.2-1.stateless.x86_64 install

I have to say, however, that I've never got this to work. Happily, Erlang's file structure is quite simple. The progam files are in /usr/local/lib/erlang (by default) and there are a bunch of links in /usr/local/bin. Once Erlang is installed on the host you can copy the files to the mounted vnfs:

cp -r /usr/local/bin/* /mnt/centos-5.2-1.stateless.x86_64/usr/local/bin
cp -r /usr/local/lib/erlang /mnt/centos-5.2-1.stateless.x86_64/usr/local/lib

I rebooted a node, connected over ssh, and typed erl. Everything looks fine.

3 comments:

Kevin Kadow said...

I was unable to compile 'otp_src_R12B-5]' successfully under CentOS5.2, turned out I needed to patch one makefile, as shown in this patch for a 32-bit system to successfully build with SSL support.

Once patched, erlang compiles, with many warnings.

chewmanfoo said...

Guys, maybe you already found this, if not, this will help. You can add a link in yum to EHEL this way:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

and then install erlang and all it's dependencies on CentOS by typing "yum install erlang".

Badiane said...

I've read a few articles from your blog that were interesting. May I ask? Why did you choose CentOS instead of Debian? The reason for my question is that you seemed to be stopped more often then not slight little shortcomings of how it's packaged as in the case of lacking Erlang packages. I wanted to take a look at Erlang and simply apt-get -f install erlang. I run the testing branch which is more stable than the name connotates.