How to Install MongoDB 8.0 on Ubuntu 24.04
Install MongoDB 8.0 Community Edition on Ubuntu 24.04 from MongoDB’s signed APT repository, then verify mongod and connect with mongosh.
On this page
MongoDB 8.0 Community Edition supports Ubuntu 24.04 LTS (Noble Numbat) on 64-bit x86 and ARM systems. This guide installs the official mongodb-org package from MongoDB’s APT repository and verifies the running server. See MongoDB’s Ubuntu installation guide and platform support matrix for current details.
Ubuntu’s separate mongodb package is not maintained by MongoDB and conflicts with mongodb-org. If it is installed, remove it before proceeding. If this system already contains MongoDB data, make and verify a backup before replacing packages.
Prerequisites
- Ubuntu 24.04 LTS (Noble) on
amd64orarm64. - A user account with
sudoprivileges. - Internet access.
- A fresh MongoDB installation, or a verified backup and upgrade plan for any existing data.
Add MongoDB’s APT Repository
Install gnupg and curl if they are not already available:
sudo apt-get update
sudo apt-get install -y gnupg curl
Import MongoDB’s public signing key into an APT keyring:
curl -fsSL https://pgp.mongodb.com/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
Add the MongoDB 8.0 repository for Ubuntu 24.04:
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | \
sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
Refresh APT’s package index and check that mongodb-org is available from MongoDB’s repository:
sudo apt-get update
apt-cache policy mongodb-org
The candidate should be an 8.0 release from repo.mongodb.org. MongoDB publishes maintenance updates within the 8.0 series, so the patch version may change.
Install MongoDB Community Edition
Install the official metapackage and its components:
sudo apt-get install -y mongodb-org
Start and Verify MongoDB
Enable the mongod service at boot and start it:
sudo systemctl enable --now mongod
Check the service status and query the server version:
sudo systemctl status mongod --no-pager
mongosh --quiet --eval 'db.version()'
Connect to the local server with the MongoDB Shell:
mongosh
Manage the MongoDB Service
Use systemctl to manage the server:
sudo systemctl start mongod
sudo systemctl stop mongod
sudo systemctl restart mongod
sudo systemctl status mongod --no-pager
Troubleshooting
- If APT cannot find
mongodb-org, runsudo apt-get updateand check that/etc/apt/sources.list.d/mongodb-org-8.0.listnames thenoble/mongodb-org/8.0repository and the correct architecture. - If
mongoddoes not start, checksudo systemctl status mongod --no-pagerand review recent service logs withsudo journalctl -u mongod -e --no-pager. - MongoDB binds to localhost by default. Before allowing remote connections, configure authentication and network controls as described in MongoDB’s production notes.
Conclusion
You installed MongoDB 8.0 Community Edition on Ubuntu 24.04 from MongoDB’s signed APT repository, started mongod, and verified the server version. For Debian 12, see our MongoDB installation guide. For Ubuntu 22.04, see our MongoDB installation guide. For more MongoDB material, browse the MongoDB Reference.