How to install MongoDB 6 on Fedora 37
Mongodb 6 installation on Fedora Linux 37. Article shows lacking fragment of official docs and two steps after installation that are presented in extremely simple way in comparison to other sources.

Daniel Gustaw
• 2 min read

In official docs there is instruction only for Redhat
Install MongoDB Community Edition on Red Hat or CentOS — MongoDB Manual
and it contains $releasever
in repository file. But on fedora $releasever
is not defined. So to fix it you can check url
https://repo.mongodb.org/yum/redhat/
and see that higest version of redhat is 9. Because of Fedora is experimental polygon of Redhat you can derive conclusion that it should works if you use redhat repository on fedora like this:
sudo tee /etc/yum.repos.d/mongodb-org-6.0.repo<<EOF
[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/9/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc
EOF
Now you can install by
sudo dnf install -y mongodb-org
so there are two assumptions that are correct:
- using redhat repo for fedora works
- using dnf for yum repos works
Now you have to start mongod
service
sudo systemctl start mongod
And you can connect with mongodb by mongosh
Mongosh is better than mongo
command because of colors and autocompletion, so use mongosh
instead of mongo
.
Mongo compass
To browse mongo in graphic mode you will probably choose compass. Following after
Download and Install Compass — MongoDB Compass
you can download rpm
packages
wget https://downloads.mongodb.com/compass/mongodb-compass-1.35.0.x86_64.rpm
and install it
sudo dnf install -y mongodb-compass-1.35.0.x86_64.rpm
Enable Mongo Replica Set locally
Replication described here:
Replication — MongoDB Manual
is required by prisma
so I am enabling it locally.
In file /etc/mongod.conf
you have to replace
#replication:
by
replication:
replSetName: "rs0"
then reload mongod
service
sudo systemctl restart mongod
Login to database by mongosh
and use command
rs.initiate()
then you can confirm changes by
rs.status()
If you experiencing more complications there is great article with advanced config
How To Configure a MongoDB Replica Set on Ubuntu 20.04 | DigitalOcean
Other articles
You can find interesting also.

Login by Metamask - Rest Backend in Fastify (Node, Typescript, Prisma)
We building from scratch rest api in fastify using mongodb connected by prisma as database, jest as test framework and etherjs to verify signatures signed by metamask.

Daniel Gustaw
• 21 min read

Analysis of Zipf's Law in Node.js
Learn how to read large files in Node.js, count word occurrences using the Map object, and handle memory limits.

Daniel Gustaw
• 6 min read

How to download contact data for 20k lawyers in an hour
Discover the parallel scraping technique that can significantly speed up data retrieval.

Daniel Gustaw
• 16 min read