Install mongodb from git in Fedora 29

Although the usual method to install mongodb in Fedora is by using official Fedora repo, I’ll install mongodb from official mongodb github repo.

git clone

Make sure you have python3 from Fedora, in my case I disabled use of Anaconda.

pip3 install -r etc/pip/compile-requirements.txt

This will install python3 dependencies in your system. Beware of following errors:

gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
error: command 'gcc' failed with exit status 1

Use dnf search to look for missing packages.

install sudo dnf install redhat-rpm-config-118-1.fc29.noarch

Python.h missing:

psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

Again, use dnf search to look for Python.h

sudo dnf install python3-devel-3.7.3-1.fc29.x86_64
sudo dnf install scons
sudo dnf install python3-scons
 sudo dnf install g++

Now, use, this script is similar to unix build tools automake/autoconf:

python3 buildscripts/ [mongo | all ]

Fix errors from scons stage:

Traceback (most recent call last):
File "src/mongo/base/", line 45, in
from Cheetah.Template import Template
ModuleNotFoundError: No module named 'Cheetah'

Cheetah was installed at beginning but not found because I was using python3 from Anaconda installation. I removed Anaconda from my path.

Install this package:

sudo dnf install gcc-aarch64-linux-gnu-8.1.1-3.fc29.x86_64

After fixing all build errors you will get mongod binary:

Skipping ranlib for thin archive build/opt/mongo/db/commands/libstandalone.a
Linking build/opt/mongo/mongod
Install file: "build/opt/mongo/mongod" as "mongod"
scons: done building targets.

Beware that using “all” parameter will create mongod, mongo. mongos and mongo-tests. Together, 200 GB will be used by this build.

If you want to install only mongod server:

python3 buildscripts/ mongod

Note that this build will create fedora binary with debug information. That’s ok because next post will walk-through mongod source code.

Leave a Reply

Your email address will not be published. Required fields are marked *