CouchDB on Rails (part 7 of ?)
- An introduction to CouchDB
- Installing CouchDB
- Experimenting with CouchDB's web interface
- Integrating with Rails using ActiveCouch
- Integrating with Rails using RelaxDB
- Getting to scaffolding using RelaxDB
- Installing CouchDB from Subversion source code
- 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
Just to prove that it worked! :)
Part 8: Trying out couchrest and topfunky’s basic_model
Related posts (automatically calculated)
