Skip to content

Building MongoDB 1.5.7 on Ubuntu 10.04

2010/08/02

Long story short; mongoid 1.9.1 and mongodb 1.2.2 don’t play nice.

So, the logical next step is to install the most recent version of MongoDB (1.5.7) from source, and hope like crazy that it doesn’t break anything.  HAHAHA!

As it turns out, mongo can experience some degradation on SpiderMonkey 1.6, so better safe than sorry, might as well build that cheeky monkey first.

Download and extract it:

$ curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
$ tar zxvf js-1.7.0.tar.gz

Build it:

$ cd js/src
$ export CFLAGS="${CFLAGS} -DJS_C_STRINGS_ARE_UTF8"
$ make -f Makefile.ref

Install that bad mutha:

$ sudo env JS_DIST=/usr make -f Makefile.ref export

Which for some reason created a directory named ../../dist, instead of actually installing to /usr, so I copied the compiled files manually (well, sort of.)

$ for i in bin include lib64; do sudo cp usr/$i/* /usr/$i/ ; done

These were the directions I followed, more or less.

Now we can move on to Mongo.  Rather, dependencies for Mongo.  You could hunt around for the boost libraries you need, and good luck with that, then pcre.  Or, let apt-get do its voodoo fo’ you, foo!

$ sudo apt-get build-dep mongodb
$ sudo apt-get install libpcap-dev
$ sudo apt-get install xulrunner-1.9.2-dev

Then, do the git clone thing:

$ git clone git://github.com/mongodb/mongo.git

Find and checkout the latest stable branch:

$ git checkout -b `git tag -l | tail -n 1`

Build sucka, build!

$ scons all

If you have a bitchingly fast machine with like a million cores, you can roll a -j into your scons command.  Por ejemplo, if you have a Core i7, to build with 16 concurrent tasks, simply issue.

$ scons all -j 16

It’ll make your head swim.

Install:

$ sudo scons --prefix=/usr install

Run the post install script

$ sudo bash debian/postinst configure

Copy the init, upstart, and config scripts to the typical locations

$ sudo cp debian/init.d /etc/init.d/mongodb
$ sudo cp debian/mongodb.upstart /etc/init/mongodb.conf
$ sudo cp debian/mongodb.conf /etc/

Make the mongodb init script executable (having fun yet?)

$ sudo chmod 755 /etc/init.d/mongodb

Start mongo

$ sudo /etc/init.d/mongodb start

Then confirm it worked with

$ mongo --version

You should see something like

MongoDB shell version: 1.5.7

As long as the version number is >= 1.4.0, you’re golden.

These instructions were adapted from the MongoDB documentation.  While researching SpiderMonkey problems I also stumbled across this concise guide, and this mailing list thread which might also be worth a look.

Good luck!

Advertisements
Leave a Comment

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 )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: