How do I install Riak on Ubuntu?

Go back to Table of Contents


As a production server I can imagine that Ubuntu would probably be the most common deployment platform for Riak. In this guide I will explain how to install Riak 0.7.1 on 32 bit Ubuntu, and it should work on both Ubuntu 8 and Ubuntu 9. I do not show how to install the latest at time of writing (February 2010) version of Riak which is 0.8 as I couldn't get it to work.

However, I had alot of problems getting Riak to work with both Ubuntu 8 and Ubuntu 9. I feel it is enough to say that Riak has a very bad "Out of the box" experience for developers. This needs to be fixed if it is to become popular.The reason I say the experience is bad is because by just following the instructions on the Riak site you cannot get through all the problems with installation. Basho (the company behind Riak) needs to provide a shell script or something for and click and install experience, or they should allow it to be installed via Synaptics package manager. Hopefully this guide will ease the pain for you when installing Riak on Ubuntu.

As you probably know, Riak is written in Erlang, so Erlang needs to be installed first. Ubuntu 9 comes with Erlang already built in, but it is the wrong version and apt-get install erlang installs the wrong version, so Erlang on Ubuntu 9 needs to be uninstalled first. Anyway, to install Riak the following seemed to work for me (logged in as root - I know its bad!) First uninstall lthe old version of Erlang (5.7.2 on my system):


su
apt-get clean apt-get remove erlang-base
apt-get remove erlang


: Some other libraries needed for Riak should be installed. If you don't perform this step then when building Erlang you may see the error:

configure: error: No curses library functions found
configure: error: /bin/bash '/otp_src_R13B03/erts/configure' failed for erts


: so build these libraries first with:

apt-get install build-essential libncurses5-dev m4 

apt-get install openssl libssl-dev 

: Then an updated version of Erlang should be installed (5.7.4):

cd /
wget http://erlang.org/download/otp_src_R13B03.tar.gz 
tar zxf otp_src_R13B03.tar.gz 
cd otp_src_R13B03/ 
./configure 
make
make install


Once this has completed then you need to test that Erlang has been installed:

erl


: This should start off the erl interactive command line and should look something like this:

# erl
Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]
Eshell V5.7.4 (abort with ^G)


: Note the version number. It should be at least 5.7.4.

: Then install Riak itself :

wget http://hg.basho.com/riak/get/riak-0.7.1.tar.gz
tar xzf riak-0.7.1.tar.gz 
cd riak 
make all rel
export RIAK=`pwd`


: And finally to test the installation:

cd rel/riak
bin/riak start
bin/riak-admin test


: should produce something like:

=INFO REPORT==== 5-Feb-2010::08:33:12 ===
Successfully completed 1 read/write cycle to 'riak@127.0.0.1'


This tests that it can connect to Riak . It may also make sense to put this into an installation script (please redistribute this Basho!) as: 

ubuntu-install-riak-0.7.sh 

apt-get clean 
apt-get remove erlang-base
apt-get remove erlang

apt-get install build-essential libncurses5-dev m4 
apt-get install openssl libssl-dev

cd /
wget http://erlang.org/download/otp_src_R13B03.tar.gz 
tar zxf otp_src_R13B03.tar.gz 
cd otp_src_R13B03/ 
./configure 
make
make install

cd /
wget http://hg.basho.com/riak/get/riak-0.7.1.tar.gz
tar xzf riak-0.7.1.tar.gz 
cd riak 
make all rel
export RIAK=`pwd`

cd rel/riak
bin/riak start

sleep 5
bin/riak-admin test 


: Remember, you should use su first to switch to the superuser before you run the script. You may also notice that sleep 5 has been added before the Riak node is tested. This is to give the node time to start up before being tested. The final output should be something like :

=INFO REPORT==== 10-Feb-2010::11:00:30 === Successfully completed 1 read/write cycle to 'riak@127.0.0.1'


To have a directory full of these installation scripts would do wonders for Riak I feel, as then installation on Linux, Mac, Solaris, FreeBSD, and especially Windows would encourage people to try out Riak and deploy it in their organisations.

Thats it for installing Riak on Ubuntu. Most of the other things in Riak are not Ubuntu specific so you should be able to follow them just fine along with Mac users as well.

1 comment: