Install latest MongoDB in Ubuntu

The MongoDB version available from the default Ubuntu/Debian repositories can be fairly old. Luckily it is easy to get a newer version directly from 10gen repository

# If necessary, remove previous installation
# sudo apt-get remove mongodb
# Add appropriate key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
# Add Repository to sources.list
echo deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen >> /etc/apt/sources.list
# Since we modifed repositofy list we need to run update
sudo apt-get update
# Fetch and install mongodb
sudo apt-get install mongodb-10gen

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