CouchDB on Rails (part 2 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

It occurs to me that before i can get Rails working with CouchDB it would be a good idea to actually install CouchDB! I'm going to try the download rather than the SVN source code because i'm clueless with SVN. So here goes. I am downloading version 0.8.1.

Edit to add: If you want to install from Subversion, see my later tutorial in Part 7: Installing CouchDB from Subversion source code

Ah, the README tells me i need Erlang and a few other things. Since i use Debian i can apt-get some packages. (Have i ever said how much i love Debian?!)

# apt-get install build-essential erlang libicu36 libicu36-dev libmozjs-dev

That was easy! Now on with the CouchDB install.

$ ./configure
$ make
$ su
# make install
# exit

Awesome! All done!

I like to clean up temporary files afterwards. It's a virgo thing.

$ make clean
$ make distclean

Do i really need to make a new user and group just to run CouchDB? Can't the owner just be me? Oh well, at this stage in the game i'm going to do as i'm told, but this seems a bit odd to me.

$ 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

Okay, so the couchdb user owns the directories that make CouchDB work. So apparently i can use sudo to impersonate the couchdb user and run the command 'couchdb'.

$ sudo -i -u couchdb couchdb

Well apart from a little error, that seems to have worked.

CouchDB is running!

So now i can apparently go to http://localhost:5984/_utils/index.html and see something …

Installed CouchDB

Nice! And apparently there are some test specs i can run … ah yes, the link is there on the right …

CouchDB running its tests

Awesomeness abounds!! All the tests passed!

The server console tells us what is happening as it runs the tests:

Output of CouchDB tests

I see some RESTful calls to POST, GET, PUT and DELETE there, and some responses: 200 for OK, 201 for Created, and 202 for Accepted. That is neat!

In the next part i will experiment and see what i can do with CouchDB via the web interface. For now, i'll go to bed happy that i got it installed and running. That was a very easy and satisfying install. :)

Part 3: Experimenting with CouchDB's web interface

Related posts (automatically calculated)

  1. CouchDB on Rails (part 7 of ?)
  2. CouchDB on Rails (part 6 of ?)
  3. CouchDB on Rails (part 3 of ?)
  4. CouchDB on Rails (part 5 of ?)
  5. CouchDB on Rails (part 4 of ?)

This entry was posted on Sunday, September 7th, 2008 at 22:33 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.

10 Responses to “CouchDB on Rails (part 2 of ?)”

  1. Chris Anderson UNITED STATES Mac OS X Safari 525.20.1 Says:

    Wow. Really happy to see that you had such an easy time installing CouchDB!

    I'm looking forward to reading the rest of your CouchDB series. If you have any trouble with CouchDB please do step into the #couchdb IRC channel on freenode. We're there most of the time, tending toward the US morning, as a lot of the participants are on European time.

    I hope you have as much success getting to hello world on your first application as you did with installation!

  2. Aimee UNITED KINGDOM Debian GNU/Linux Mozilla Firefox 2.0.0.16 Says:

    Hi Chris, thank you!

    You know what? In all my 28 years of existing, i have never once been in an IRC. Maybe it's time to confront my fear and give it a try!

  3. Jan GERMANY Mac OS X Safari 526.11.2 Says:

    @Aimee, Twitter is enough of a time-sink if you are sensitive to that ;) But welcome on IRC, if you like. Also, keep it up, this series looks very promising already.

  4. Aimee UNITED KINGDOM Debian GNU/Linux Mozilla Firefox 2.0.0.16 Says:

    Thanks Jan, i am encouraged by your approval :)

  5. Jan GERMANY Mac OS X Safari 526.11.2 Says:

    Part three and four today then? :D

  6. Aimee UNITED KINGDOM Mac OS X Mozilla Firefox 2.0.0.16 Says:

    Haha, wait and see …!

  7. Ruben Fonseca PORTUGAL Debian GNU/Linux Mozilla Firefox 3.0.1 Says:

    Thanks Aimee! I'm starting tou get encouraged to try CouchDB by reading your articles :)

    Can't wait for the next parts!

  8. Aimee UNITED KINGDOM Mac OS X Mozilla Firefox 2.0.0.16 Says:

    Woohoo! I am pleased to hear that! :)

  9. Noah Slater UNITED KINGDOM Debian GNU/Linux Mozilla Firefox 3.0.1 Says:

    Hey Aimee, glad you found the install instructions easy to follow.

    Sorry about the little problem when you start up CouchDB, that's actually a bug with the documentation that I fixed this week.

    To correct the problem on your system, open the /etc/passwd file as root and find the line corresponding to the CouchDB user and replace /var/lib/couchdb with /usr/local/var/lib/couchdb

  10. Aimee UNITED KINGDOM Mac OS X Mozilla Firefox 2.0.0.16 Says:

    Aha, great, i thought there would be an easy fix for it. It's not a problem anyway; the service still runs just fine. Thanks for the clarification.

Leave a Reply