Install CouchDB on Gentoo

Update 2009-04-01: CouchDB 0.9.0 has been released. A new bug has been started in the Gentoo Bugzilla for an update to Portage.

Update 2009-03-23: CouchDB 0.8.1 has been committed to Portage so if you want to use stable rather than alpha, portage has your back. JChris has also mentioned that a new release is approaching :)

Installing CouchDB is super simple thanks to the Gentoo community keeping this bug updated. However what isn’t super simple is if your new to doing your own Protage Overlay and digesting ebuilds and all that fun stuff.

When I was looking to install CouchDB on Gentoo a few weeks ago I had to do about 5 Google searches to get all the information required. So here I present to you a complete walk through.

First thing you want to do is create your directory for the overlay files.

$ mkdir /usr/local/portage

Now go and update make.conf so it knows you are using an overlay

$ echo PORTDIR_OVERLAY=\"/usr/local/portage\" >> /etc/make.conf

The thing to do is get all the files and put them in a category/package directory. CouchDB is a database so it fits nicely into the category “dev-db” and it make sense to just call the package “couchdb”. So create those directories like this:

$ mkdir -p /usr/local/portage/dev-db/couchdb

Now you can go to the bug and download the attachments or you can download this file with everything in it. If you download the files from the bug then save them in /usr/local/portage/dev-db/couchdb. Otherwise this will work for the bundle I’ve provided.

$ cd /usr/local/portage/dev-db/couchdb/
$ wget http://is.gd/lTGc
$ tar -jxf couchdb.ebuild.20090305.tar.bz2
$ rm couchdb.ebuild.20090305.tar.bz2

For each ebuild you need to have a Manifest file. To create one all you do is run the following command.

$ ebuild ebuild_file digest

So for the CouchDB ebuild files it is (if you downloaded my all in one file, I’ve all ready done it, you can do it if you want, it makes no difference)

$ ebuild couchdb-0.8.1.ebuild digest
$ ebuild couchdb-9999.ebuild digest

You should have a files sub-directory with the conf & init files. If you used my bundle then you have this, otherwise go to the bug page and get them.

Now you need to choose the version you want to install so you can add it to the keywords file as these ebuild are masked. They both work – it’s just the 9999 is the current 0.9 alpha version as is in svn trunk and 0.8.1 is considered stable. So do one of the following:

$ echo =dev-db/couchdb-9999 >> /etc/portage/package.keywords
or
$ echo =dev-db/couchdb-0.8.1 >> /etc/portage/package.keywords

The last thing to do is update portage and emerge CouchDB. If you have a cron script that syncs portage then you don’t need to do this.

$ emerge --sync

You should be able to emerge couchdb and start it.

$ emerge -av couchdb
$ /etc/init.d/couchdb start

If you are running on a remote machine you’ll want to go and change the bind_address so you can access it. All the options are available in /etc/couchdb/local.ini. Once you have updated the options in there simply restart couchdb and open up your browser and goto http://bind_address:5984.

That’s it – Now you need to go read the book :)

  • Arachnid

    Thanks for this! It was extremely helpful.

  • http://nicholasorr.com Nicholas Orr

    Nice :)

    I did because when I was looking I had to do a few Google searches, now it
    is a single Google Search