How to Install MongoDB 8.0 on Rocky Linux 9
Install MongoDB 8.0 Community Edition on Rocky Linux 9 x86_64 from MongoDB’s signed Yum repository, then start and verify mongod.
On this page
This guide installs MongoDB 8.0 Community Edition on Rocky Linux 9 x86_64 from MongoDB’s official RHEL-compatible package repository. MongoDB documents Rocky Linux 9 support when the distribution provides full RHEL compatibility. See the official MongoDB 8.0 platform notes before using another Rocky version or architecture.
Prerequisites
- Rocky Linux 9 x86_64.
- A sudo-enabled account and internet access.
- A fresh installation, or a verified backup and migration plan for existing MongoDB data.
Add the MongoDB 8.0 repository
Create the repository file:
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
Install MongoDB Community Edition:
sudo dnf install -y mongodb-org
MongoDB packages named mongodb-org come from MongoDB’s repository. Do not confuse them with unrelated distribution packages named mongodb.
Start and verify MongoDB
Enable the server at boot and start it now:
sudo systemctl enable --now mongod
Check the service and server version:
sudo systemctl status mongod --no-pager
mongosh --quiet --eval 'db.version()'
Connect to the local server with the MongoDB shell:
mongosh
MongoDB binds to localhost by default. Before allowing remote connections, configure authentication and network controls; see MongoDB’s production notes.
Summary
MongoDB 8.0 Community Edition is installed from MongoDB’s signed Rocky/RHEL 9 repository. For MongoDB installation on another supported platform, see the Debian 12 guide or the Ubuntu 24.04 guide.