Installing CouchDb 1.0.1 on Ubuntu 10.04 0

Posted by dave
on Friday, September 03

CouchDb 1.0.1 is hard to install from source on Ubuntu 10.04, mainly because the libmozjs-dev package doesn’t exist in the apt repos. If you try following the CouchDb install from source directions, you’ll get a message like this:

configure: error: Could not find the js library.
Is the Mozilla SpiderMonkey library installed?

CouchDb relies on Mozilla’s SpiderMonkey javascript engine, but that’s not available in Ubuntu 10.04.

This should install most dependencies:

sudo apt-get build-dep couchdb

In case build-dep didn’t get this one:

sudo apt-get install xulrunner-dev

Grab the SpiderMonkey source from the Mozilla website, build it, and install it:

wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.0-rc1.tar.gz
tar -xvzf js-1.8.0-rc1.tar.gz
cd js/src
make BUILD_OPT=1 -f Makefile.ref
sudo make BUILD_OPT=1 JS_DIST=/usr/local -f Makefile.ref export

That’ll build and install libjs – but after a reboot, couchdb may lose track of where you’ve installed libjs. You could mess around with environment variables every time you spark up couch, but you might want to make it more permanent by informing ldconfig of the library’s location. Assuming you’re on 64-bit, you can do this:

sudo touch /etc/ld.so.conf.d/spidermonkey.conf
sudo echo "/usr/local/lib64" >/etc/ld.so.conf.d/spidermonkey.conf
sudo ldconfig

Adjust as necessary for 32-bit systems if you’re running one of those.

After that you should have no trouble grabbing the CouchDb source, untarring it, and doing the configure-make-make-install dance:

wget http://apache.mirror.anlx.net//couchdb/1.0.1/apache-couchdb-1.0.1.tar.gz
tar -xvzf apache-couchdb-1.0.1.tar.gz
cd apache-couchdb-1.0.1
./configure && make && sudo make install