Binaries are available for most platforms. Most users won’t need to compile MongoDB themselves. Every prebuilt binary has been regression tested. See the Downloads page for these prebuilt binaries.
MongoDB can be compiled for Windows (32 and 64 bit) using Visual C++. SCons is the make mechanism, although a solution file is also included in the project for convenience when using the Visual Studio IDE. (These instructions don’t work using Visual Studio Express, which must be uninstalled to get Visual Studio Professional/Ultimate to work properly. VSE can only do 32 bit builds.)
These instructions are for MongoDB versions 2.1.1 and later.
Do one of the following:
Download the source code from Downloads page
Install Git, then:
Clone the repository by issuing the following:
git clone git://github.com/mongodb/mongo.git
For more information, see https://github.com/mongodb/mongo.
To see tagged version numbers, issue the following:
git tag -l
Switch to a stable branch (unless doing development). An even second number indicates “stable”. For example:
git checkout r2.4.0
Open the src/vs2010_mongodb.sln solution file.
Install Python: http://www.python.org/download/releases/2.7.2/.
Make sure to install the 32-bit version of python and not the 64-bit as the SCons binaries below are 32-bit.
It is recommended you install pywin32 if you want to do parallel builds (scons -j): http://sourceforge.net/projects/pywin32/
Add the python scripts directory (e.g., C:\Python27\Scripts) to your PATH.
scons --release --64 // build mongod scons --release --64 mongoclient.lib // build C++ client driver library scons --release --64 core // build all end user components
Add --64 or --32 to get the 64- and 32-bit versions, respectively. Replace --release with --dd to build a debug build.
If you are using SCons, check the file config.log that is generated.
If SCons does not automatically find Visual Studio, try using the Visual Studio Command Prompt, which sets the path for you. Alternatively, set your path manually by running the VS2010 vcvars*.bat files. Location varies with install but is something like: