Installing couchdb

OK, so I’ve spent most of the morning installing couchdb on my Ubuntu oneiric ocelot server.  Thought I would note down the steps so that I could remember how to do it next time!

The resources I’ve used include:

guide.couchdb.org/draft/source.html

till.klampaeckel.de/blog/archives/55-CouchDB-on-Ubuntu-on-AWS.html

1.  Download from couchdb.apache.org/downloads.html.  I used apache-couchdb-1.1.1.tar.gz.  With my Ubuntu the download is saved to Downloads directory in my home directory [~/Downloads].

2.  I then unpacked into the same Downloads directory:

tar -zxvf ~/Downloads/apache-couchdb-1.1.1.tar.gz

3.  CD into the newly extracted folder, in my case, apache-couchdb-1.1.1

4.  Couchdb installs 5 new directories: bin; etc; lib; share; var.  I wanted an obvious named directory to hold all of these.  So,

./configure --prefix=/opt/couchdb
make

5.  I used checkinstall to help management of the application.  There was an error creating sub-directories which was fixed by using the –fstrans option.

sudo checkinstall -y --fstrans=0 --pkgname=apache-couchdb --pkgversion=1.1.1
--maintainer=[name]@[address] --pakdir=/opt --pkglicense=Apache

6.  I created a user named ‘couchdb’.  But I ran into a problem when switching to the new user in the terminal, I didn’t know what the password was, and it wouldn’t accept an empty string.  So I created a password for the couchdb user.

sudo adduser --system --home /opt/couchdb/var/lib/couchdb --no-create-home
--shell /bin/bash --group --gecos "CouchDB" couchdb
sudo passwd couchdb

7.  I created 2 symlinks:

sudo ln -s /opt/couchdb/etc/init.d/couchdb /etc/init.d/couchdb
sudo ln -s /opt/couchdb/etc/logrotate.d/couchdb /etc/logrotate.d/couchdb

8.  I changed ownership of the new directories:

chown -R couchdb:couchdb /opt/couchdb/etc/couchdb
chown -R couchdb:couchdb /opt/couchdb/var/lib/couchdb
chown -R couchdb:couchdb /opt/couchdb/var/log/couchdb
chown -R couchdb:couchdb /opt/couchdb/var/run/couchdb

8.  I changed permission on the directories:

chmod -R 0770 /opt/couchdb/etc/couchdb
chmod -R 0770 /opt/couchdb/var/lib/couchdb
chmod -R 0770 /opt/couchdb/var/log/couchdb
chmod -R 0770 /opt/couchdb/var/run/couchdb

9.   Switching to the couchdb user on the terminal I started the newly minted couchdb database:

su couchdb
service couchdb start

10.  Running the test scripts in the futon administration app, I had four failures:

attachments

auth_cache

list_views

rev_stemming

The cause of this might have been using the localhost:5984/_utils URL.  These pass when using 127.0.0.1:5984/_utils

11.  However, in the meantime I decided to download a standalone version of couchdb and see if that would boot without errors in the tests!

So, over to https://github.com/iriscouch/build-couchdb

12.  I followed the clear instructions.  I had to install git, this was the only additional step.

sudo apt-get install git

13.  The rake step took ages, about 30 minutes, and now my standalone couchdb is a mammoth 500Mb directory.  The advantage is that this can be deleted to remove the install.  Starting the db isn’t so sweet:

build/bin/couchdb

Since control isn’t passed back to the terminal.  And I couldn’t figure how to stop it without closing the terminal!

14.  The same errors occurred on the tests in futon with this install; smelling a red-herring this is what caused me to investigate and conclude that these were not important.

Advertisement

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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