Binaries are available for most platforms. Most users do not need to compile MongoDB themselves. In addition, every prebuilt binary has been regression tested. See the Downloads page for prebuilt binaries.
These build instructions apply to the MongoDB git master branch (https://github.com/mongodb/mongo) and to versions 2.1.1 and onward.
You must have the following:
To install the above on Fedora, issue the following:
sudo yum -y install git-core scons gcc-c++ glibc-devel
To install the above on Ubuntu, issue the following:
sudo apt-get install git-core build-essential scons
Install any needed prerequisites (see above).
Get the source code:
git clone git://github.com/mongodb/mongo.git cd mongo
Pick a version to build (only use “master” if you are doing development work).
List all tagged versions:
git tag -l
Check out a tagged release, e.g. 2.4.0:
git checkout r2.4.0
Install. Use --prefix to specify where you want to install your binaries. The default is /usr/local.
scons --prefix=/opt/mongo install