How to install mongodb server on Fedora


Mongo (from “humongous” – huge) is a high-performance, open source, schema free, document oriented database. It is one of the most popular NoSQL databases. It uses JSON as the document format and can be extended and replicated between multiple server nodes.

Stories about license changes

Mongodb upstream has decided to change the license of the server code for more than a year. The previous license was GNU affino general public license V3 (AGPLv3). However, upstream companies have written a new license to enable companies running mongodb as a service to give back to the community. The new license is called server side Public License (ssplv1). For more information about this initiative and its interpretation, see mongodb SSPL FAQ.

Fedora has always included only free software. When SSPL was released, Fedora determined that it was not a free software license. All mongodb versions released prior to the license change date (October 2018) can be retained in Fedora, but packages that are never updated later pose security issues. So, starting with Fedora 30, the Fedora community decided to completely remove the mongodb server.

What other options do developers have?

Yes, there are alternatives, such as PostgreSQL, which also supports JSON in the latest version, which can be used when mongodb is no longer available. With the jsonb type, the index works well in PostgreSQL, and its performance is comparable to mongodb, even without being affected by acid.

The technical reasons why developers might choose mongodb do not change with the license, so many people still want to use it. It is important to realize that the SSPL license change is only for the mongodb server. Mongodb upstream has also developed other projects, such as mongodb tools, C and C + + client libraries, and connectors for various dynamic languages, which are used by clients (in applications that communicate with servers over the network). Since the licensees of these packages remain free (mainly Apache licenses), they remain in the Fedora repository, so users can use them for application development.

The only change is actually the server package itself, which has been completely removed from the Fedora repository. Let’s look at how Fedora users can get non free packages.

How to install mongodb server from upstream

When Fedora users want to install mongodb server, they need to get mongodb directly upstream. However, the upstream does not provide RPM packages for fedora. On the contrary, mongodb server can obtain the source tarball, and users need to compile by themselves (this requires some development knowledge), or Fedora users can use some compatible packages. Among the compatible options, rhel-8 rpm is the best choice. The following steps describe how to install them and start the daemons.

1. Create warehouse using upstream RPM (rhel-8 build)

$ sudo cat > /etc/yum.repos.d/mongodb.repo >>EOF
name=MongoDB Upstream Repository

2. Install metapackages to pull servers and toolkits

$ sudo dnf install mongodb-org
 mongodb-org-4.2.3-1.el8.x86_64 mongodb-org-mongos-4.2.3-1.el8.x86_64 
 mongodb-org-server-4.2.3-1.el8.x86_64 mongodb-org-shell-4.2.3-1.el8.x86_64

3. Start mongodb Daemons

$ sudo systemctl status mongod
● mongod.service - MongoDB Database Server
 Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
 Active: active (running) since Sat 2020-02-08 12:33:45 EST; 2s ago
 Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
 Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
 Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
 Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 15773 (mongod)
 Memory: 70.4M
 CPU: 611ms
 CGroup: /system.slice/mongod.service

4. Connect to the server through Mongo shell to verify whether it is running

$ mongo
MongoDB shell version v4.2.3
connecting to: mongodb://
Implicit session: session { "id" : UUID("20b6e61f-c7cc-4e9b-a25e-5e306d60482f") }
MongoDB server version: 4.2.3
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see

That’s it. As you can see, the rhel-8 package is perfectly compatible and should always be compatible as long as the Fedora package is still compatible with rhel-8. Please note that the ssplv1 license must be followed when using.


This article introduces the method of installing mongodb server on fedora. For more information about how to install mongodb server in Fedora, please search the previous articles of developeppaer or continue to browse the related articles below. I hope you can support developeppaer more in the future!

Recommended Today

Java security framework

The article is mainly divided into three parts1. The architecture and core components of spring security are as follows: (1) authentication; (2) authority interception; (3) database management; (4) authority caching; (5) custom decision making; and;2. To build and use the environment, the current popular spring boot is used to build the environment, and the actual […]