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 http://svn.apache.org/repos/asf/incubator/couchdb/trunk 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.

$ ./bootstrap

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.

$ ./configure
$ make
$ 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:

$ su
# chown -R aimee /usr/local/var/lib/couchdb
# chown -R aimee /usr/local/var/log/couchdb
# exit

And now …

$ couchdb
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 …

$ su
# 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/
# exit

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

Related posts (automatically calculated)

  1. CouchDB on Rails (part 2 of ?)
  2. Installing Ruby on Rails on Debian Lenny
  3. CouchDB on Rails (part 5 of ?)
  4. CouchDB on Rails (part 6 of ?)
  5. CouchDB on Rails (part 8 of ?)

This entry was posted on Sunday, September 14th, 2008 at 18:03 and is filed under couchdb. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply