
As a Linux professional, mastering how to install and configure MongoDB will empower you to leverage the full power of this popular NoSQL database for
Learn how to install MongoDB (Community or Enterprise) on RHEL 10 / CentOS 10 with step‑by‑step repository setup, CLI commands, SELinux tips, and troubleshooting.”
MongoDB is a leading NoSQL document database often used in production and development environments. If your organization is running RHEL 10 or CentOS 10, you may want to deploy MongoDB directly on the host (or within containers). This guide describes how to install MongoDB (Community or Enterprise) on RHEL 10 | CentOS 10, including repository configuration, dependency issues, service setup, security, and troubleshooting.
⚠️ Important compatibility note: As of the time of writing, MongoDB’s official documentation does not list RHEL 10 | CentOS 10 among its supported platforms. The official guide for MongoDB Enterprise covers RHEL / CentOS 8 and 9 only. MongoDB Therefore, using MongoDB on RHEL 10 may require workarounds, community builds, containers, or using older supported RHEL versions. But this guide shows the best practices and options given that reality. |
Before proceeding, check the following:
|
|
|
|
|
|
Also, keep in mind:
|
|
|
Start by updating the package metadata and ensuring basic tools are in place:
sudo dnf update -y
sudo dnf install -y epel-release
# Install EPEL release package on RHEL 10
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %rhel).noarch.rpm
Because MongoDB RPMs may have been built against older OpenSSL, you might need to enable legacy crypto policy:
sudo update-crypto-policies --set LEGACY
Setting system policy to LEGACY
Note: System-wide crypto policies are applied on application start-up.
It is recommended to restart the system for the change of policies
to fully take place.
sudo reboot
This sets the system to allow older crypto expectations (use with caution).
⚠️ If you run into dependency errors tied to |
Given the lack of official RHEL 10 support, here are your main paths:
|
|
|
|
In this guide, we’ll illustrate option (1) and option (3) (as fallback). As of the date of this posting, Option #1 installs MongoDB on RHEL 10 | CentOS 10 without issue but mongod.service fails to start.
If you decide to try with the official MongoDB repo designed for RHEL 9 (hoping compatibility works):
🔵 Community Edition Example (MongoDB 8.0) |
Create /etc/yum.repos.d/mongodb-org-8.0.repo
:
sudo vim /etc/yum.repos.d/mongodb-org-8.0.repo
Copy and paste the following content:
[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
🔵 Enterprise Edition Example (MongoDB Enterprise 8.2) |
Create /etc/yum.repos.d/mongodb-enterprise-8.2.repo
:
[mongodb-enterprise-8.2]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/9/mongodb-enterprise/8.2/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://pgp.mongodb.com/server-8.0.asc
Then refresh:
sudo dnf makecache
⚠️ Warning: Since baseurl points to “redhat/9”, you’re forcing a RHEL 9 build. Compatibility may or may not work — test carefully. |
Import the GPG key:
sudo rpm --import https://pgp.mongodb.com/server-8.0.asc
Then install packages. For Community:
sudo dnf install -y mongodb-org
Photo by admingeek from Infotechys
Or specific versions:
sudo dnf install -y \
mongodb-org-8.0.12 \
mongodb-org-database-8.0.12 \
mongodb-org-server-8.0.12 \
mongodb-org-mongos-8.0.12 \
mongodb-org-tools-8.0.12 \
mongodb-mongosh
For Enterprise:
sudo dnf install -y mongodb-enterprise
✋If you encounter errors like “nothing provides libcrypto.so.1.1” or similar, it indicates binary incompatibility with RHEL 10’s libraries. |
If the native RPM approach fails, using a container is safer and more maintainable. Here’s a Podman example. Create a volume for persistent data:
podman volume create mongo_data
Pull MongoDB image:
podman pull mongo:8.0
? Please select an image:
registry.access.redhat.com/mongo:8.0
registry.redhat.io/mongo:8.0
▸ docker.io/library/mongo:8.0
✔ docker.io/library/mongo:8.0
Trying to pull docker.io/library/mongo:8.0...
Getting image source signatures
Copying blob b92a15b39d95 done |
Copying blob 4b3ffd8ccb52 done |
Copying blob e20d020ae6f3 done |
Copying blob 5f211690369e done |
Copying blob c61448294a5e done |
Copying blob 31b397d90832 done |
Copying blob 3c9ec5e75886 done |
Copying blob b92ad19150f3 done |
Copying config b9196ab1f1 done |
Writing manifest to image destination
b9196ab1f1e1083d834e668b1e5ed49aca5b8012904f6a5922d0a50161646092
Run container:
podman run -d \
--name mongodb \
-v mongo_data:/data/db \
-p 27017:27017 \
mongo:8.0
Check logs:
podman logs mongodb
Connect using mongosh
(locally or from another container). This method isolates dependencies and avoids host-level library mismatches.
If the dnf install
method succeeded:
sudo systemctl daemon-reload
sudo systemctl start mongod
sudo systemctl enable mongod
sudo systemctl status mongod
× mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Sat 2025-10-11 15:43:37 EDT; 30s ago
Duration: 303ms
Invocation: 6c7bdb8e70fa49ac99b0b1092f4a3b18
Docs: https://docs.mongodb.org/manual
Process: 2585 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=48)
Main PID: 2585 (code=exited, status=48)
Mem peak: 25.5M
CPU: 70ms
Oct 11 15:43:36 localhost.localdomain systemd[1]: Started mongod.service - MongoDB Database Server.
Oct 11 15:43:36 localhost.localdomain mongod[2585]: {"t":{"$date":"2025-10-11T19:43:36.999Z"},"s":"I", "c":"CONTROL", "id":7484500, "ctx":"main","msg":"Environment variable
To debug:
sudo journalctl -u mongod --no-pager
sudo less /var/log/mongodb/mongod.log
Then connect:
mongosh
> show dbs
> db.test.insertOne({x:1})
> db.test.find()
Check listening port:
ss -tunlp | grep 27017
After you have MongoDB running (either native or container), apply the following security steps:
|
security:
authorization: "enabled"
Then restart the service or container.
|
use admin
db.createUser({
user: "admin",
pwd: "StrongPassword123!",
roles: [ { role: "root", db: "admin" } ]
})
|
sudo firewall-cmd --add-port=27017/tcp --permanent
sudo firewall-cmd --reload
💡NOTE: If SELinux is enforcing and you used non-default paths or custom ports, apply or build an SELinux module. MongoDB upstream provides a policy module for default installs (for RHEL 7+), but on RHEL 10 it may not cover your customizations. |
Approach | Pros | Cons / Risks |
---|---|---|
Native RPM (using RHEL 9 repo) | Seamless service integration, systemd use | Likely library mismatches or dependency failures |
Container (Podman / Docker) | Isolation, predictable behavior | Slight overhead, port mapping, container lifecycle management |
Build from source | Max compatibility | Complexity, maintenance burden |
Community / Third‑party build | Potential tailored compatibility | Trust & security risk, updates may lag |
Given the newness of RHEL 10 relative to official support, many practitioners prefer the container approach for production use on RHEL 10.
|
|
|
|
|
Installing MongoDB on RHEL 10 or CentOS 10 presents unique challenges due to the platform’s relative newness and the lack of official MongoDB support for this release at the time of writing. Unlike RHEL 8 or 9, there are no MongoDB RPMs specifically built for RHEL 10 in the official MongoDB repositories. This means users attempting native installations must rely on RHEL 9 binaries, which can lead to compatibility issues—particularly around OpenSSL libraries, GPG key validation, and system dependencies. Despite these challenges, there are still viable ways to deploy MongoDB reliably on RHEL 10:
|
|
No matter the approach, here are a few best practices to follow:
|
|
|
|
|
In short, while RHEL 10 is a cutting-edge platform, it currently sits ahead of MongoDB’s official packaging and support cycle. Until direct support arrives, consider containerized MongoDB the safest route—and revisit native installations once official RPMs for RHEL 10 are published.
Did you find this article helpful? Your feedback is invaluable to us! Feel free to share this post with those who may benefit, and let us know your thoughts in the comments section below.
As a Linux professional, mastering how to install and configure MongoDB will empower you to leverage the full power of this popular NoSQL database for
Linux professionals can unlock new career opportunities and stay ahead of the curve by harnessing the power of big data, a transformative technology that is
In this comprehensive guide, we’ll walk through the process of deploying a MySQL database using Podman, covering installation, configuration, and best practices. Table of Contents