Fresh Blurbs

Install CouchDB On Debian Squeeze from Source

Following is a step-by-step guide to installing the latest CouchDB release on Debian Squeeze from sources.

Installing Prerequisites

$ sudo apt-get update
$ sudo apt-get install build-essential
$ sudo apt-get install libssl0.9.8 libssl-dev zlib1g zlib1g-dev lsb-base
$ sudo apt-get install ncurses-dev libncurses-dev
$ sudo apt-get install unixodbc unixodbc-dev xsltproc
$ sudo apt-get install libmozjs-dev libmozjs1d libicu-dev
(if you get an error on libmozjs1d, try: libmozjs2d)
$ sudo apt-get install libcurl4-dev libcurl4-openssl-dev # (if libcurl-dev is not already installed)

Installing Erlang/OTP

$ cd /usr/local/src
$ sudo wget
$ sudo tar xzvf otp_src_R14B03.tar.gz
$ cd opt_src_R14B03
$ sudo ./configure
$ sudo make && sudo make install # (this will complain about jinterface, wx, and documentation; you can ignore these)

Installing CouchDB

$ cd /usr/local/src
$ sudo wget
$ sudo tar xzvf apache-couchdb-1.1.0.tar.gz
$ cd apache-couchdb-1.1.0
$ sudo ./configure --prefix=/usr
$ sudo make && sudo make install

$ sudo /usr/sbin/adduser --system --home /usr/var/lib/couchdb --no-create-home --shell /bin/bash --group --gecos "CouchDB Administrator" couchdb

Configuring CouchDB

By default CouchDB only attaches itself to If you need to connect to it from outside the server (e.g. to access embedded web-based control panel) either:

  • (preferred method!) Tunnel to from Apache or NginX
  • or edit /usr/etc/couchdb/default.ini and chage IP in the bind instruction to IP

Setting proper permissions:\

    sudo chown -R couchdb:couchdb /usr/etc/couchdb
    sudo chown -R couchdb:couchdb /usr/var/lib/couchdb
    sudo chown -R couchdb:couchdb /usr/var/log/couchdb
    sudo chown -R couchdb:couchdb /usr/var/run/couchdb
    sudo chmod 0770 /usr/etc/couchdb
    sudo chmod 0770 /usr/var/lib/couchdb
    sudo chmod 0770 /usr/var/log/couchdb
    sudo chmod 0770 /usr/var/run/couchdb

Start CouchDB manually:\

$ sudo -i -u couchdb /usr/bin/couchdb

Startup script:\

sudo /usr/etc/init.d/couchdb start
sudo /usr/etc/init.d/couchdb stop

Once CouchDB successfully starts, you can access web-based interface at:\


where should be replaced by your server IP, of course.

Bonus: Installing CouchREST Ruby Gem for CouchDB

$ sudo gem install couchrest
$ sudo gem install couchrest_model


$ irb
irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "couchrest"
=> true
irb(main):003:0> require "couchrest_model"
=> true
irb(main):004:0> db = CouchRest.database!("http://localhost:5984/irakli")
=> http://localhost:5984/irakli

For more information about CouchRest Model please visit the official website:

comments powered by Disqus