Wednesday, 30 September 2009

Build CouchDB on Ubuntu 9.10 (Karmic Koala)

Ubuntu 9.10 includes CouchDB in the standard desktop installation ... perhaps that's all you need?

Personally, I like to track CouchDB trunk but building on the latest Ubuntu is not quite as easy as it used to be. The following is mostly from memory so may not be quite right ...

The list of packages in the CouchDB README to compile from source does not work (at least, not for me). Instead, ensure your apt sources are up to date and install the following packages:

$ sudo apt-get install build-essential erlang-nox erlang-dev libicu-dev xulrunner-dev libcurl4-openssl-dev

Next, configure CouchDB to use xulrunner's headers and libraries, using a custom LD_RUN_PATH:

$ LD_RUN_PATH=/usr/lib/xulrunner- ./configure --with-js-lib=/usr/lib/xulrunner-devel- --with-js-include=/usr/lib/xulrunner-devel-

And then make with the same LD_RUN_PATH:

$ LD_RUN_PATH=/usr/lib/xulrunner- make

Finally, make install CouchDB as usual and you're ok to start the CouchDB server.

Note that if Ubuntu's standard CouchDB package is also installed you may need to avoid your install clashing with it. Edit your install's etc/couchdb/local.ini and set port in the httpd section to something different. I use 15984 but it doesn't really matter as long as it's unique.


AK said...

Sorry, but this is quite interesting so can you provide some context to this, like what sudo apt-get packages are required.

Matt Goodall said...

@AK I've just rewritten the post. I hope it helps but, if not, let me know and I'll try to help.

AK said...

Thanks for sharing this. I just setup a vm of karmic and I'm just itching to experiment (-:

Matt Goodall said...

I just updated the post with the latest xulrunner paths (it's just been upgraded) and to use LD_RUN_PATH instead of LD_LIBRARY_PATH. LD_RUN_PATH gets built into the binary at link time making it faster and easier to run once installed.

Anonymous said...

It compiled using your commands but when I try to run the testsuite or doing anything I get {"error":"bad_request","reason":"invalid UTF-8 JSON"}
Did you have the same Error or a solution for that?

Matt Goodall said...

@Anonymous Sorry, not seen that error.