CouchDB on Rails (part 7 of ?)

  1. An introduction to CouchDB
  2. Installing CouchDB
  3. Experimenting with CouchDB’s web interface
  4. Integrating with Rails using ActiveCouch
  5. Integrating with Rails using RelaxDB
  6. Getting to scaffolding using RelaxDB
  7. Installing CouchDB from Subversion source code
  8. Trying out couchrest and topfunky’s basic_model

Yesterday i started using the couchrest plugin, only to run into problems with the spec tests because it is built for latest latest CouchDB. So i had to install from Subversion source, but i got into a terrible mess, and to cut a long story short, i reinstalled the operating system today! I am now on shiny new Debian Lenny, woohoo! :D

So hopefully today i will successfully show you how to install from source!

First you need Subversion, if you don’t already have it.

sudo apt-get install subversion

Make a directory for storing source code, and checkout couchdb into it:

mkdir ~/src
cd ~/src
svn co couchdb
cd couchdb

Read the README very carefully! Don’t make the same mistake as i did which is to assume it’s the same as installing from a tarball. It isn’t.

sudo apt-get install automake autoconf libtool help2man

The source code must be ‘bootstrapped’, whatever that means.


Now there are another bunch of dependencies to make sure you have installed!

sudo apt-get install build-essential erlang libicu38 libicu-dev libmozjs-dev curl libcurl4-openssl-dev

Whew! The libmozjs-dev was what gave me all the trouble last night, so i’m glad to have got past that particular hurdle. It’s so nice to have an up-to-date operating system, much as i dislike the actual process of upgrading.

Now let’s try installing.

sudo make install

Great, everything worked!

couchdb -V
couchdb - Apache CouchDB 0.9.0a695251-incubating

Would it be so terrible to run couchdb as myself, rather than making a special couchdb user? Can’t i just do this:

chown -R aimee /usr/local/var/lib/couchdb
chown -R aimee /usr/local/var/log/couchdb

And now …

Apache CouchDB 0.9.0a695251-incubating (LogLevel=info) is starting.
{"init terminating in do_boot",{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

Okay, fair enough, you do have to create a special user! Now we know! ;)

So, just as i did before to create a couchdb user …

adduser --system --home /var/lib/couchdb --no-create-home --shell /bin/bash --group --gecos "CouchDB Administrator" couchdb
chown -R couchdb /usr/local/var/lib/couchdb/
chown -R couchdb /usr/local/var/log/couchdb/

And now i can impersonate that user to run the couchdb command (fingers crossed) …

sudo -i -u couchdb couchdb
sudo: unable to change directory to /var/lib/couchdb: No such file or directory
Apache CouchDB 0.9.0a695251-incubating (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.

Very good! :D

CouchDB latest latest running its tests!

Just to prove that it worked! :)

Part 8: Trying out couchrest and topfunky’s basic_model


9 comments on “CouchDB on Rails (part 7 of ?)

  1. Saltmarch Media is organizing Great Indian Developer Summit event in Bangalore. This Summit will be a boost for the Software Developing Industries. It covers the topics like .Net, Java, CouchDB, MongoDB, SimpleDB and Richweb and has 1 day workshop at the end as well. Any one attending this event?Register @

  2. What will I do with this information? Actually I have no need of this. I will ask my friend whether he has any use of it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s