How to install mongodb from source code

Hi Satya,

Please make sure you are following the 4.2 version of Building MongoDB instructions (which should be docs/building.md in your source checkout).

The SCons install-mongod target used in your output is for a newer server release branch (4.4 or master) and should be mongod for 4.2.

It looks like you have an appropriate version of gcc/g++ installed, but perhaps there are conflicting versions in your path.

–CC=/opt/rh/devtoolset-8/root/usr/bin/gcc --CXX=/opt/rh/devtoolset-8/root/usr/bin/g++

These options should be set as environment variables, not as parameters. Try including these in your SCons command line without the leading --:

CC=/opt/rh/devtoolset-8/root/usr/bin/gcc CXX=/opt/rh/devtoolset-8/root/usr/bin/g++

I noticed you are building MongoDB 4.2.3. The latest 4.2 release is currently 4.2.8 (see MongoDB 4.2 Minor Releases). I strongly recommend staying current with minor releases for the latest security and stability fixes.

If your client is concerned about security and stability, the official packages should provide more assurance on that front than building from source. All builds are extensively tested via our public (and open source) Evergreen CI and published packages are signed for verification.

If you build from source, there may be variations in your build environment that cause unexpected issues.

Regards,
Stennie

1 Like