Installing mongo-db on Ubuntu

Update: As Kiran points out in his comment, the initial three apt-get are not required. apt-get mongodb-stable should suffice. Also, no harm is done if you do it exactly the way mentioned below.

First install the dependencies. Helpful if you plan to work on the code or build from source. Helpful otherwise too. So just do it.

$ apt-get -y install tcsh git-core scons g++ $ apt-get -y install libpcre++-dev 
 libboost-dev libreadline-dev xulrunner-1.9.1-dev
$ apt-get -y install libboost-program-options-dev libboost-thread-dev 
 libboost-filesystem-dev libboost-date-time-dev 

Next, import the 10gen signing key (company that makes mongodb)
$ apt-key adv --keyserver --recv 7F0CEB10

Then, add the 10gen repo to the apt sources.list
$ sudo gedit /etc/apt/sources.list

Also, add the following line for ubuntu 9.10

debĀ 9.10 10gen

save and exit.

Finally, install mongo-db
$ apt-get -y install mongodb-stable

You can also get the edge version using
$ apt-get -y install mongodb-unstable $ apt-get -y install mongodb-snapshot

Then check the installation
$ mongo

You should be doing fine by now.

Reference 1

Reference 2