Ubuntu – How to upgrade mongodb 1.8 to 2.2 on ubuntu

mongodbUbuntu

Following this guide: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/ I ended up with mongodb 18 on my Ubuntu 10.04.

I've just read the 2.2 mongodb release notes on upgrading and it says to just replace the binary. Would that be /usr/lib/mongodb/mongod ?

It looks like the 2.2 tar has several files I might need to copy over: mongo, mongod, mongoexport, mongodump, mongofiles, mongoimport, mongorestore, mongos, xulwrapper

Can I just copy and paste all of those over to replace the old versions of those files?

Best Answer

You can overwrite the MongoDB binaries, that will work fine

However, there is no possible way you installed version 1.2.2 - that version is not available on the repositories mentioned in the installation instructions (and it is ancient - from Jan 2010) - the only versions are 1.8, 2.0 and 2.2.

You may be confusing it with a driver version - PHP maybe?

If you run /usr/lib/mongodb/mongod --version it will tell you the version of mongod that is actually installed.

If you installed one of the lower versions and want to upgrade, I would recommend just removing the older package:

sudo apt-get remove mongodb18-10gen

Then install the latest stable release (as of writing that would be 2.2.2):

sudo apt-get install mongodb-10gen