Warning: installing Riak 1.0.2 was painful.
Basho no longer provides a package or any support for such an old version. The docs go back no further than version 1.1.0.
So why bother?
Seven Databases in Seven Weeks uses version 1.0.2 for its examples. I wanted to play along at home.
In the end, here’s what worked for me.
This bit just worked.
sudo apt-get install git
This was the hardest part to get right.
Apparently, Erlang has “slight nuances” between even minor versions.
Don’t install the latest version; it’s too new. Don’t install R14 either; it’s too old.
In the end, the exact version R14B02 worked for me.
The Basho docs recommend something called kerl for installing specific Erlang versions.
sudo apt-get install curl
sudo apt-get install libncurses5-dev
curl -O https://raw.github.com/spawngrid/kerl/master/kerl; chmod a+x kerl
./kerl build R14B01 r14b02
./kerl install r14b02 ~/erlang/r14b02
You have to run that last line every time you want to use Erlang in a new shell.
Getting Erlang right was made harder by a little quirk of the Riak complation process. Each component does its own version check. It can take a while for compilation to fail. Couldn’t that be checked up-front?
Before I read the manual more carefully, I saw lots of variants of this message.
ERROR: OTP release R14B does not match required regex R14B0
So what’s the simplest way to check your Erlang version?
$ erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
That’s just obtuse. So obtuse that at some point I’ll have to read Seven Languages in Seven Weeks to find out why.
To be fair, this part was mostly difficult because other components were either buggy or unfamiliar.
Once I sorted out my envioronment, the Basho stuff did exactly what it said on the tin.
Use these commands to fetch version 1.0.2 from Github:
git clone https://github.com/basho/riak.git
git checkout tags/riak-1.0.2
Cloning the whole repo to ‘checkout’ one tag doesn’t really make sense to me, but I don’t know Git very well. I was just following the winning answer on Stack Overflow.
Git warned me that I was in ‘detached HEAD’ state. Amusing and baffling in equal measure.
One more thing: there’s a crap bug in the default compiler tools on 64-bit Xubuntu 13.04. It might affect other distributions too.
To avoid an error like this:
ERROR: cc c_src/skein.o c_src/skein_api.o c_src/skein_block.o c_src/skein_debug.o c_src/skerl_nifs.o -lstdc++ -shared -L/home/sandport/erlang/r14b02/lib/erl_interface-3.7.3/lib -lerl_interface -lei -o priv/skerl_nifs.so failed with error: 1 and output:
/usr/bin/ld: cannot find -lstdc++
sudo apt-get install g++-multilib
Now, finally, the good stuff.
Sit back, sip a beer, and wait about 15 minutes for Riak to compile.
Next, fire it up…
…and kick the tyres.
$ bin/riak-admin test
Successfully completed 1 read/write cycle to 'firstname.lastname@example.org'
Now for Day 1: CRUD, Links, and MIMEs.
Data technology is changing fast. The literature can hardly keep up. It’s an exciting time to be a database engineer!
Avoid installing from source if possible. Packages exist to let you get on with your life.
Be skeptical when someone says “building my project from source is quite easy.” They don’t know your environment.