Building mongodb with openssl support on Windows is not for the faint hearted. This short tutorial teaches you how to do it.
You can download my prebuilt binaries from Sourceforge if you want to get started quickly. Binaries for both x86 and x64 are available starting from mongo 2.4.9.
In order to run mongodb with ssl support on Windows Server 2008 R2 or newer the following prerequisites are required:
- Visual C++ 2008 Redistributables (32bit / 64bit)
- Visual C++ 2010 Redistributables (32bit / 64bit)
- Openssl 1.0.1f (32bit / 64bit)
- Create a new folder on your disk called
mongodb-ssl - Download and extract Winpcap 4.1.2 Developers pack into
mongodb-ssl\winpcap git clone https://github.com/mongodb/mongo.git mongodb-ssl\mongocd mongodb-ssl\mongogit checkout r2.4.9
NB! You do not need a working Visual Studio 2010 CD-KEY after your trial expires because we are only interested in the compilers.
- Visual Studio 2010 Professional (web installer)
- Visual C++ 2008 Redistributables (32bit / 64bit)
- Visual C++ 2010 Redistributables (32bit / 64bit)
- Python 2.7
- Python for Windows extensions
- Scons 2.3.0
- Openssl 1.0.1f (32bit / 64bit)
NB! If the python installer does not do it for you, please remember to add C:\Python27\scripts to your PATH environment variable otherwise scons will not be found.
NB! Before you continue you need to change line 71 in C:\OpenSSL-Win32\include\openssl\dtls1.h from winsock.h to winsock2.h otherwise mongosniffer.exe will fail to compile.
-
Modify
mongodb-ssl\mongo\SConstructat line 287 and add the following entry toenv = Environment(:MSVC_USE_SCRIPT = "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat", -
Run the following line in a Visual Studio 2010 command prompt
scons all --release --32 --ssl --win2008plus --extrapath="C:\OpenSSL-Win32" -
You shall see unicorns in
mongodb-ssl\mongo\build\win32\32\extrapath_C__OpenSSL-Win32\release\ssl\mongofolder.
-
Modify
mongodb-ssl\mongo\SConstructat line 287 and add the following entry toenv = Environment(:MSVC_USE_SCRIPT = "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\amd64\\vcvars64.bat", -
Run the following line in a Visual Studio 2010 command prompt
scons all --release --64 --ssl --win2008plus --extrapath="C:\OpenSSL-Win64" -
You shall see unicorns in
mongodb-ssl\mongo\build\win32\64\extrapath_C__OpenSSL-Win64\release\ssl\mongofolder.