Install MongoDB on RHEL 10 | CentOS 10

Install MongoDB on RHEL 10 | CentOS 10

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.”

Table of Contents

🔈Introduction

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.

🔧 Prerequisites & Considerations

Before proceeding, check the following:

  • ✅ You obviously need RHEL 10 | CentOS 10 installed.
  • ✅ You need root or sudo privileges.
  • ✅ Internet access to download RPMs or GPG keys (or offline mirror).
  • ✅ If SELinux is enforced, certain policies or adjustments may be needed.
  • ✅ Decide whether you want Community (open source) or Enterprise edition (commercial support).
  • ✅ Awareness that package dependencies (especially OpenSSL / crypto libraries) may not match MongoDB’s expectation.

Also, keep in mind:

  • ✅ Since RHEL 10 is newer than the officially supported platforms, your best route may be a container (Podman / Docker) or building from source rather than using standard repos.
  • ✅ Many users running MongoDB on newer distributions face library dependencies like libcrypto or libssl mismatches.
  • ✅ Always test in a staging environment first.

🔄 Step 1: System Update & Prep

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 libcrypto.so.1.1 or similar, this step often mitigates those. (Many users on RHEL 9 reported such errors with MongoDB 8.0 builds.)

🔄 Step 2: Choose Your Installation Approach

Given the lack of official RHEL 10 support, here are your main paths:

  • Use the official MongoDB RPM repo for version built for RHEL 9 or 8—and hope binary compatibility holds (risky).
  • Use a community / third‑party build / repo explicitly targeting RHEL 10.
  • Use containerized MongoDB (Podman, Docker) on RHEL 10.
  • Build MongoDB from source targeting your environment.

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.


🔄 Step 3: Configure Repository (Attempt Official RPM Approach)

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.

🔄 Step 4: Import GPG Key & Install MongoDB

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
				
			
Install MongoDB on RHEL 10 | CentOS 10

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.

🔄 Step 5: Container Fallback (Recommended for RHEL 10)

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.


🔄 Step 6: Start / Enable / Test (Native Installation)

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
				
			

🔄 Step 7: Secure & Configure (Same as Usual)

After you have MongoDB running (either native or container), apply the following security steps:

  • Enable authentication in /etc/mongod.conf:
				
					security:
  authorization: "enabled"
				
			

Then restart the service or container.

  • Create an admin user:
				
					use admin
db.createUser({
  user: "admin",
  pwd: "StrongPassword123!",
  roles: [ { role: "root", db: "admin" } ]
})
				
			
  • If using firewalld on host (for native install):
				
					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.

📊 Comparison & Decision Table

ApproachProsCons / Risks
Native RPM (using RHEL 9 repo)Seamless service integration, systemd useLikely library mismatches or dependency failures
Container (Podman / Docker)Isolation, predictable behaviorSlight overhead, port mapping, container lifecycle management
Build from sourceMax compatibilityComplexity, maintenance burden
Community / Third‑party buildPotential tailored compatibilityTrust & 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.


📝 Troubleshooting Tips (RHEL 10 Specific)

  • libcrypto / libssl errors: This is the most common issue — check ldd /usr/bin/mongod or the RPM dependency chain. The native system may ship newer OpenSSL versions, so your MongoDB RPM may not find the expected older libcrypto.so.1.1.
  • GPG key import issues: Ensure your HTTPS connectivity is fine and the correct key URL is used.
  • Service fails to start: Check SELinux denials via ausearch or journalctl, permissions on data/log directories, or port conflicts.
  • Conflict with system crypto policies: Resetting to LEGACY or temporarily using a looser policy can help.
  • Container starts but no data persists: Ensure your volume mount is correct (e.g. mongo_data:/data/db) and that container runs with correct user permissions.

🏁 Conclusion

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:

  • Containerized deployment (via Podman or Docker) is the most reliable and future-proof method for running MongoDB on RHEL 10 today. Containers isolate MongoDB from the host’s libraries, avoid dependency conflicts, and simplify upgrades and rollbacks. This approach is especially useful for developers, DevOps teams, or hybrid cloud environments.
  • For advanced users, building MongoDB from source offers full compatibility at the cost of complexity and maintenance overhead.

No matter the approach, here are a few best practices to follow:

  • Test thoroughly in staging before moving to production.
  • Use containerization when compatibility is uncertain or you need rapid deployments.
  • Monitor SELinux and crypto policies if using native installs.
  • Secure your MongoDB instance with authentication, proper firewall rules, and user access control.
  • Stay updated on MongoDB’s release notes and platform support to know when RHEL 10 becomes officially supported.

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.


📕 Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *