Skip to content

How to install Mongodb in Ubuntu or Debian (simple)

shimondoodkin edited this page Nov 30, 2010 · 1 revision

To install Mongodb follow this guide:

http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages

if you have installed mongodb using Ubuntu distribution you can remove it with the command:

sudo apt-get remove mongodb

or remove it and remove its configuration:

sudo aptitude purge mongodb

purge means remove and clean configuration.


No need to read below this line. It is description of the problem.

At the moment in the official Ubuntu distribution of Mongodb is broken.

because it is compiled linked to XULrunner (libmozjs.so) with a static version number. meanwhile the version of XULrunner is shifted. and you get

"mongo: error while loading shared libraries: libmozjs.so: cannot open shared object file: No such file or directory"

I have executed strace mongod to see what is happening

strace is a trace utility that shows all API function calls parameters behind the running program.

Later I have executed strace mongod|grep libmozjs.so and found out where it is searching the missing file.

you could get this error because that libmozjs-dev is not installed so you can install it:

sudo apt-get install xulrunner-dev

also it could be that xulrunner has a newer version and it is under a different folder like:

/usr/lib/xulrunner-1.x.x.x/libmozjs.so

to fix it you could link the new version to a shared place.

sudo ln -s /usr/lib/xulrunner-1.9.2.6/libmozjs.so /usr/lib/

one problem with that is that you will have to do it each time xulrunner is updated.