How To Install MongoDB on Fedora 44

Install MongoDB on Fedora 44

Anyone who has tried installing MongoDB on a fresh Fedora box knows the frustration: the official MongoDB repositories don’t ship native Fedora packages, Fedora’s own release cadence runs far ahead of what MongoDB officially certifies, and a single missed dependency can leave mongod refusing to start with a cryptic exit code. Fedora 44 makes things a little more interesting too, since it shipped with dnf5 as the default package manager, kernel 7.1, and a noticeably stricter default security posture around SELinux and firewalld compared to older releases.

If you’ve spent any time managing production database servers, you already know that “just run the installer” almost never applies to real environments. There’s repository trust to configure, service hardening to think through, storage engine tuning, and the inevitable troubleshooting when systemctl status mongod throws something unexpected. This guide walks through the entire process the way an experienced admin would actually do it on a live server, not a sandbox VM you’ll throw away tomorrow.

We’ll cover the repository setup that actually works with Fedora’s RPM-based system (MongoDB doesn’t build Fedora-specific packages, so you borrow the RHEL 9 build), the dnf5 command differences that trip people up, SELinux context management, firewalld rules for both local and remote access, authentication hardening, and the performance tuning that separates a demo database from one that can survive a real traffic spike. By the end, you’ll have a MongoDB instance that’s not just running, but running the way it should on a system you’re responsible for.

Why Fedora 44 Needs a Slightly Different Approach

Fedora 44 arrived in late April 2026 as a leading-edge release, and that’s exactly the point of Fedora as a distribution: it moves fast and picks up upstream changes long before RHEL or its downstream clones do. That’s great for developers who want the newest kernel features or GCC 16, but it’s a headache for anyone trying to run enterprise database software that’s only certified against specific, slower-moving Linux distributions.

MongoDB Inc. doesn’t publish Fedora-native RPMs. Never has. What they publish are RHEL-compatible builds, and the trick that’s worked reliably for years (going back to Fedora 34, 36, and every release since) is pointing Fedora’s DNF at the RHEL 9 MongoDB repository. Because Fedora and RHEL share the same underlying RPM packaging conventions and largely compatible glibc/systemd behavior, this cross-compatibility trick keeps working even on Fedora 44, despite the six or seven major version gap between them.

The other wrinkle is dnf5. Fedora switched to dnf5 as the default package manager starting with Fedora 41, and by Fedora 44 it’s fully baked in with no dnf4 fallback installed by default. Most commands behave the same, but a few flags changed behavior slightly, and some older tutorials floating around the web reference dnf syntax that will throw warnings (though usually not hard failures) on dnf5. We’ll flag those spots as we go.

Before You Start: System Requirements and Pre-Checks

Don’t skip this part, even if you’re eager to get to the install commands. A rushed install without these checks is exactly how admins end up debugging a “MongoDB won’t start” ticket at 2 a.m.

Minimum recommended specs for a MongoDB 8.0 instance running any real workload:

  • 2 CPU cores minimum, 4+ for anything beyond light development use
  • 4 GB RAM minimum, 8 GB or more if you’re running the WiredTiger cache with any meaningful working set
  • SSD-backed storage strongly preferred over spinning disks; MongoDB’s write-ahead journal and WiredTiger checkpoints are I/O-sensitive
  • A 64-bit architecture, since MongoDB dropped 32-bit builds years ago

Check your current Fedora release and kernel before proceeding:

cat /etc/fedora-release
uname -r

You should see something like Fedora release 44 and a 7.x kernel version. Also confirm you’re running as a user with sudo privileges, not directly as root, which is good practice on any production server regardless of what software you’re deploying.

Update the system first. This matters more than people think, because installing a new repository against a stale package database is a common source of dependency resolution errors:

sudo dnf upgrade --refresh -y

That --refresh flag forces DNF to re-sync repository metadata rather than trusting a potentially outdated local cache. On a server that hasn’t been touched in a few weeks, skipping this step is asking for trouble later.

Step 1: Import the MongoDB GPG Key

Every package you install should be verifiable against a cryptographic signature, and MongoDB’s official builds are signed. Import the current signing key before you configure the repository itself:

sudo rpm --import https://pgp.mongodb.com/server-8.0.asc

Note the domain here. MongoDB migrated their key hosting from mongodb.org to pgp.mongodb.com a while back, and a surprising number of older blog posts still reference the deprecated URL. If you copy a repo config from a 2022-era tutorial, double-check this detail or your gpgcheck will fail silently and DNF will complain about untrusted packages.

Step 2: Create the MongoDB Repository File

This is the step that actually bridges Fedora to MongoDB’s officially supported builds. Create a repo definition file targeting the RHEL 9 MongoDB 8.0 repository:

sudo tee /etc/yum.repos.d/mongodb-org-8.0.repo > /dev/null <<'EOF'
[mongodb-org-8.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/9/mongodb-org/8.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://pgp.mongodb.com/server-8.0.asc
EOF

A few things worth understanding here rather than just copy-pasting. The redhat/9 path in the baseurl is deliberate, not a typo. Since MongoDB has no Fedora 44 build, you’re telling DNF to fetch RPMs built against RHEL 9’s ABI, which is close enough to Fedora’s userland that the packages install and run cleanly in the vast majority of cases. The gpgcheck=1 flag enforces the signature verification we set up in Step 1, and disabling it “to make errors go away” is a shortcut that should never make it into a production runbook.

Verify DNF picked up the new repository before installing anything:

sudo dnf repolist | grep mongodb

If nothing shows up, double check file permissions on the repo file and confirm there’s no typo in the .repo extension.

Step 3: Install MongoDB Packages

With the repo trusted and registered, refresh the package cache and install the metapackage:

sudo dnf makecache
sudo dnf install mongodb-org -y

The mongodb-org package is a metapackage that pulls in the full stack you actually need: the mongod server daemon, mongosh (the modern shell, which replaced the old mongo binary starting with MongoDB 6.0), database tools like mongodump and mongorestore, and the cryptd binary used for client-side field-level encryption.

On dnf5, you’ll notice the output formatting looks a bit different from classic dnf, and transaction confirmations are slightly more verbose about what’s being pulled in. That’s expected. If you want to inspect exactly what got installed without triggering another download, run:

dnf list installed | grep mongodb

You should see mongodb-org, mongodb-org-server, mongodb-org-shell (if applicable to your version bundle), mongodb-org-mongos, and mongodb-org-tools.

Step 4: Configure Data and Log Directories

The package installer typically creates /var/lib/mongo for data storage and /var/log/mongodb for logs, along with a mongod system user and group. Confirm ownership is correct, because a mismatched permission here is one of the most common reasons mongod fails on first boot:

sudo chown -R mongod:mongod /var/lib/mongo
sudo chown -R mongod:mongod /var/log/mongodb

If you’re planning to store MongoDB data on a separate disk or LVM volume (which you should on any real production box, since database I/O should never compete with the OS drive), mount that volume first and repoint the dbPath in the configuration file before starting the service for the first time.

Step 5: Understand and Adjust the Configuration File

MongoDB’s main configuration lives at /etc/mongod.conf, written in YAML. Open it up:

sudo nano /etc/mongod.conf

The default config binds mongod to 127.0.0.1 only, which is the correct default for security reasons but frequently confuses people setting up a server meant to accept remote application connections. The relevant block looks like this:

net:
  port: 27017
  bindIp: 127.0.0.1

If your application server and database live on the same host (a common pattern for smaller deployments), leave this alone. If you’re running MongoDB as a dedicated database node that other servers connect to, you’ll need to bind it to the private network interface, not 0.0.0.0 unless you fully understand the exposure implications:

net:
  port: 27017
  bindIp: 127.0.0.1,10.0.0.15

Never bind MongoDB directly to a public interface without authentication and TLS in front of it. This has been a recurring cause of publicly indexed, unauthenticated MongoDB instances getting scraped and ransomed by opportunistic bots, a problem that’s been documented for years and still happens because someone rushed a bindIp change without thinking through the security config that should go with it.

Step 6: Enable and Start the Service

Fedora uses systemd, so service management is straightforward:

sudo systemctl enable --now mongod

The --now flag both enables the service on boot and starts it immediately, saving a second command. Check that it’s actually healthy rather than just assuming success:

sudo systemctl status mongod

You want to see active (running) in green. If it shows failed or exits immediately after starting, don’t panic, that’s covered in the troubleshooting section below, and it’s genuinely one of the more common first-run issues on SELinux-enforcing systems like Fedora.

Confirm the daemon is actually listening and responding:

mongosh --eval "db.runCommand({ connectionStatus: 1 })"

A clean JSON response confirms the server is up, accepting connections, and the shell can authenticate against it (or, at this stage, connect without authentication since we haven’t enabled access control yet).

Step 7: SELinux Considerations

Fedora ships SELinux in enforcing mode by default, and this catches a lot of people off guard when they’ve only ever worked on Ubuntu or Debian where SELinux isn’t the default MAC framework. If you changed the default port, storage path, or log path from what the package expects, SELinux will silently block mongod from doing what it needs to do, and the failure often looks like a generic permission error rather than an obvious SELinux denial.

Check if SELinux is actively blocking anything:

sudo ausearch -c 'mongod' --raw | audit2allow

If you moved the data directory to a custom path (say, /data/mongodb instead of the default /var/lib/mongo), you need to relabel that directory with the correct SELinux context rather than disabling SELinux entirely, which is a lazy fix that removes an entire layer of protection on a server holding potentially sensitive data:

sudo semanage fcontext -a -t mongod_var_lib_t "/data/mongodb(/.*)?"
sudo restorecon -Rv /data/mongodb

If semanage isn’t found, install the policy management tools first:

sudo dnf install policycoreutils-python-utils -y

Step 8: Firewall Configuration

Fedora 44 runs firewalld by default, with the public zone typically active unless you’ve customized zones already. MongoDB’s default port, 27017, is not open by default, and it shouldn’t be exposed broadly regardless.

If your application connects locally on the same host, you don’t need to touch the firewall at all, since loopback traffic isn’t filtered by firewalld’s zone rules. If you have a separate application server that needs to reach this MongoDB instance over the network, open the port scoped to a specific source, not the whole internet:

sudo firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="10.0.0.20" port protocol="tcp" port="27017" accept'
sudo firewall-cmd --reload

That rich rule restricts access to a single known IP, which is a far safer approach than a blanket --add-port=27017/tcp that would let any host on the network attempt a connection. Verify the rule landed correctly:

sudo firewall-cmd --zone=public --list-rich-rules

Step 9: Enable Authentication

Running MongoDB without authentication is fine for a throwaway dev VM. It is not fine for anything touching real data, and this step gets skipped more often than it should because MongoDB doesn’t force it on you by default.

First, connect without auth (since it’s not enabled yet) and create an administrative user:

mongosh

Inside the shell:

use admin
db.createUser({
  user: "dbAdmin",
  pwd: passwordPrompt(),
  roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
})

Using passwordPrompt() avoids leaving the password sitting in your shell history, a small habit that matters when you’re managing credentials on shared or logged systems.

Now enable access control in /etc/mongod.conf:

security:
  authorization: enabled

Restart the service to apply it:

sudo systemctl restart mongod

From this point forward, every connection needs credentials:

mongosh -u dbAdmin -p --authenticationDatabase admin

Create scoped application users after this rather than reusing the admin account for your app’s connection string. A compromised application shouldn’t hand an attacker full admin rights to your entire database cluster.

Troubleshooting Common Issues

mongod fails to start with no clear error in systemctl status. Check the actual MongoDB log rather than relying on systemd’s summary:

sudo tail -n 50 /var/log/mongodb/mongod.log

Nine times out of ten this reveals the real cause, whether it’s a permissions issue, a corrupted lock file from an unclean shutdown, or a config syntax error.

“Unable to create/open lock file” errors. Usually a leftover mongod.lock from a previous unclean shutdown, or ownership drift on /var/lib/mongo:

sudo rm -f /var/lib/mongo/mongod.lock
sudo chown -R mongod:mongod /var/lib/mongo
sudo systemctl start mongod

Connection refused from a remote application server. Almost always one of two things: bindIp still set to 127.0.0.1 only, or firewalld blocking the port. Check both before assuming it’s a code issue in the app.

SELinux silently denying operations despite correct file permissions. Confirm with getenforce, then check /var/log/audit/audit.log for avc: denied entries related to mongod_t. Relabel the affected path with restorecon rather than switching SELinux to permissive mode as a permanent fix.

Package conflicts with an older MongoDB version already installed. If a previous MongoDB Community version was installed via a different repo file, clean it up first:

sudo dnf remove mongodb-org* -y
sudo rm -rf /var/lib/mongo /etc/mongod.conf

Then repeat the install steps cleanly. Mixing repo versions is a fast way to end up with a broken dependency tree that dnf5 will refuse to resolve automatically.

Performance and Optimization Tips

Once the database is running and secured, tuning it for real workloads is where experience actually pays off. A default install works fine for testing, but production traffic exposes gaps quickly.

WiredTiger cache sizing. By default, MongoDB allocates roughly 50% of available RAM (minus 1 GB) to the WiredTiger cache. On a dedicated database server, that’s usually fine. On a shared host running other services, cap it explicitly in mongod.conf:

storage:
  wiredTiger:
    engineConfig:
      cacheSizeGB: 4

Undersizing this cache causes excessive disk reads under load; oversizing it starves other processes on the same host of memory. There’s no universal number, it depends on your working set size relative to total data size.

Disk I/O scheduling. For NVMe or SSD-backed storage, confirm the kernel is using an appropriate I/O scheduler. Fedora 44’s newer kernel generally defaults sensibly, but it’s worth confirming:

cat /sys/block/nvme0n1/queue/scheduler

Indexing discipline. Slow queries under load are almost always a missing or poorly designed index, not a hardware limitation. Use the built-in profiler to catch these before they become production incidents:

db.setProfilingLevel(1, { slowms: 100 })

ulimits. MongoDB documentation recommends raising the open file descriptor limit well above the default 1024, since a busy instance with many concurrent connections will hit that ceiling fast:

sudo systemctl edit mongod

Add:

[Service]
LimitNOFILE=64000

Network throughput under traffic spikes. If you’re fronting MongoDB with a connection pool (which any serious application driver should be doing anyway), make sure the pool size matches expected concurrency rather than defaulting to whatever the driver ships with out of the box. Undersized pools cause connection queuing during spikes that looks like a database slowdown but is actually an application-side bottleneck.

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.

Related Posts