How To Install MongoDB 4.2 on Fedora 32/31/30/29

Yash Garudkar
Jun 8 · 2 min read

MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License.

I am currently using Fedora 32 on my machine, and ran into a bunch of issues and errors trying to get MongoDB installed on my machine.

So this is the solution I figured could help you save a lot of time.

All below commands are to fired on terminal.

Step 1: Update Your System

Best to use an update system

sudo dnf update

Step 2: Add mongo-db repositories

Add MongoDB 4 repositories to the system

This command is to be fired as a single command (in a single ⏎ enter)

cat <<EOF | sudo tee /etc/yum.repos.d/mongodb.repo
[mongodb-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
EOF

Step 3: Install MongoDB on the machine

Install MongoDB on Fedora 32/31/30/29/28

sudo dnf -y install mongodb-org

Step 4: Check if mongo is successfully installed

mongo -version

If mongo is successfully installed on your system the above command must return following result.

MongoDB shell version v4.2.7
git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64

Congrats! MongoDB is now ready to use on your local system.

Thank You!


Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store