Installing CouchDB on a VM

“The time to relax is when you don’t have time for it.”image  - Sydney J. Harris

After CouchDB hit its official 1.0 release, I decided to try it out and compare it to existing RDBMS, although this is probably not the right thing to do since CouchDB is based on a completely different paradigm. Anyway, I gave it a shot.

First of all, I decided that I will try it out inside a VM (Virtual Machine) and there are a few reasons for that. Back in the day, when having the opportunity to run a virtual machine on your computer was more of a privilege since resources were limited and the performance wasn’t even close compared to an actual install, doing something inside a guest system would at least earn you some weird looks – why run something inside a box when you can do the same on the host system?

But now times changed and virtual machines evolved. I can fine-tune the performance of my VM and considering the performance of the base machine (the actual hardware) I can simultaneously run two operating systems without seeing any significant performance loss for both of them (well, it still depends on what you are doing).

I use to experiment a lot with a wide variety of development tools and if I would install everything on my host system (Windows 7 Ultimate x64, if anyone interested). it will become cluttered in a matter of days and will practically be unusable. A VM provides a sandbox environment where I can do anything I want – in case something goes wrong, I can simply install a new VM instance and start from scratch. And of course, I am not risking my data on the base system.

The configuration for the VM I used is the following:

  • CPU: 1 instance
  • RAM: 512MB
  • Video memory: 12MB
  • Hard drive: 30GB
  • Guest system: Ubuntu 10.04

My first thought was using Synaptic and install CouchDB from an existing official repository. But it wasn’t the case – there is CouchDB listed over there, but it was version 0.11.0 – I wanted to install 1.0.0. Therefore, there could be only one solution – compiling from source. Although this might seem a quite complicated process, in fact once you do it two or three times, you pretty much get used to the procedure and all you have to do is make sure the proper dependencies are present.

So I went ahead and downloaded the source for the 1.0.0 release. This can simply be done via the terminal (the wget command) but you can also use the web browser – depends on personal preferences. I followed the instructions on the official wiki page (Installing CouchDB on Ubuntu) and it all went smooth – dependencies installed, the main package is ready – until the point when ./configure threw me an error – it could not find the needed JS libraries. Since libmozjs-dev is clearly not available in Ubuntu 10.04, I was sure that I installed xulrunner-dev instead. But I did not specify this for ./configure, so I restarted the process, but already used the correct library references:

./configure –prefix= –with-js-lib=/usr/lib/xulrunner-devel-1.9.2.6/lib –with-js-include=/usr/lib/xulrunner-devel-1.9.2.6/include

It all went fine, but the story isn’t over yet. It was time to compile and install the server. Simple:

sudo make && make install

But not so fast – when it almost reached the ending stage, several errors were thrown notifying me that access to several locations was denied. Since I already used chmod and chown, I was a bit confused on what might be the issue. The solution was simple – I switched to my root account for the installation (and yes, I do know that this is not a good practice – but for the purpose of properly installing CouchDB it made sense). The command went through just fine and the CouchDB server was finally installed. I tried to start the service and the message that it was successfully launched was shown. However, when I tried to use curl to see the response, an error was thrown – it could not connect to the server.

The first thought that came to my mind in this situation was restarting the VM. But it didn’t help. Looking for possible solutions, I encountered this article. I tried running this command:

sudo –u couchdb couchdb

And indeed there was a problem – the user wasn’t able to access the main couchdb folder. I was thinking in the context of user permissions, but it didn’t really apply here, so I thought about folder permissions – I probably didn’t chmod something correctly. I tried doing it again by following the instructions but no positive results with that. And then I stumbled across another article that used the correct chmod values. Worked like a charm – I restarted the service ad was able to access the Futon web UI.

nosql2

The installation wasn’t much of a “relax” at first, but the end result is worth it. Time for me to work more with it to see where I can use it and how.

One Comment to “Installing CouchDB on a VM”

  1. [...] This post was mentioned on Twitter by Richard Laksana, Den Delimarsky. Den Delimarsky said: Installing #CouchDB on a #VM http://bit.ly/dveQaj [...]


Leave a Reply