Installing the Couch(DB)

Category:UncategorizedTag: :

In my previous post, I talked about some introductory topics regarding CouchDB. In this post I want to walk you through some of the hurdles you need to take when you want to install CouchDB on a freshly installed Ubuntu Linux 9.0.4. Now I don’t want to claim that there isn’t a simpler way for getting CouchDB up and running, which probably should be the case. I just want to put out everything I had to deal with when I tried installing the trunk version (V9.0) of CouchDB. I didn’t install the pre-packaged version (V8.02) as that would be too easy :-). Here goes …

1. Prepare your environment:

sudo aptitude install automake autoconf libtool subversion-tools help2man spidermonkey-bin build-essentialerlang erlang-manpages libicu38 libicu-dev libreadline5-dev checkinstall libmozjs-dev wget

sudo apt-get install libcurl4-gnutls-dev

2. Create a new user for running CouchDB:

sudo adduser –no-create-home –disabled-password –disabled-login couchdb

3. Get the latest source code from the trunk:

svn co couchdb

4. Build and install:?

./configure –bindir=/usr/bin –sbindir=/usr/sbin –localstatedir=/var –sysconfdir=/etc
make && sudo make install

5. Make the CouchDB user, that was created in step 2, the owner of the installed binaries:

sudo chown couchdb:couchdb -R? /var/lib/couchdb /var/log/couchdb

6. Now we’re all set to launch the CouchDB server:

sudo -i -u couchdb couchdb

If everything goes well, you should see something similar as the following output:

sudo: unable to change directory to /home/couchdb: No such file
or directory
Apache CouchDB 0.10.0a780291 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.1.0>] Apache CouchDB has started.

7. In order to verify that CouchDB is up and running, you can install cURL and issue the following command:

sudo apt-get install curl
curl http://localhost:5984

This should give you the following response:


8. [Optional] Register? CouchDB as a service:

sudo update-rc.d couchdb defaults
sudo /etc/init.d/couchdb start


So far in our setup, we can only access CouchDB from the local Linux (virtual) machine. My personal goal was to access CouchDB from a sample application that I’m developing on another Windows virtual machine that hosts my development environment. In order to accomplish that, some additional steps need to be taken:

1. Open the correct port on the firewall when enabled. You can do this by issuing the following:

sudo iptables -I INPUT 3 -p tcp –dport 5984 -j ACCEPT

2. Go to the local.ini file in the /etc/couchdb/ directory and uncomment the line that specifies the bind_address setting (in the httpd section) by removing the semicolon in front of it (figuring out this one kept me busy for quite some time 😉 ).

3. Change the bind_address setting so that it now specifies instead of After restarting CouchDB, it will now bind to all addresses.

4. We’re done.

As I mentioned before, I’m quite a Linux rookie so it was definitely a challenge figuring this out.

If this all seems too much for you, then you might be interested to take a look at Interactive CouchDB. This is an online CouchDB emulator/visualizer that was completely written in JavaScript. It provides a sample DB where can play around with some map/reduce functions which I’m going to discuss in one of my next posts.

Now I need some relaxation. Till next time.

Find me



The opinions and content expressed here are my own and not those of my employer.