apt cannot find mongodb-org on Ubuntu
E: Unable to locate package mongodb-orgShort answer
Ubuntu's own package lists do not contain mongodb-org. It comes from MongoDB's own apt repository, so apt only finds it after you import the key, add the repository line for your Ubuntu codename and run apt-get update. Also confirm the release is a 64-bit LTS that MongoDB lists as supported.
Fix it fast
1Find out which cause you have
Ask apt whether any repository offers the package, and check which Ubuntu release and CPU you are on.
apt-cache policy mongodb-org cat /etc/lsb-release dpkg --print-architecture2Match what you see, then jump to its fix
- 1
apt-cache policy mongodb-org prints nothing, and /etc/apt/sources.list.d/ has no mongodb-org fileThe MongoDB repository was never added, or apt update was not run after adding itFix - 2
The repository line is correct and apt update ran, but apt-cache policy still shows no candidateThe Ubuntu release or CPU is not one MongoDB supportsFix - 3
The package stays missing even though apt update ran, and the repository file names another codenameThe repository line names a different codename than your Ubuntu releaseFix
- 1
What does the error look like?
E: Unable to locate package mongodb-orgUnable to locate package mongodb-org (after sudo apt-get install mongodb-org)
Cause 1 of 3
The MongoDB repository was never added, or apt update was not run after adding it
1Check
Look for the repository file MongoDB's guide creates. If it is missing, or you created it but did not reload the package lists, apt has nothing to search.
ls /etc/apt/sources.list.d/ | grep -i mongodb2Fix
Import the signing key, create the repository file for your Ubuntu codename (noble is 24.04), reload the package lists and install.
sudo apt-get install gnupg curl
curl -fsSL https://pgp.mongodb.com/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
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
sudo apt-get update
sudo apt-get install -y mongodb-org3Verify
apt now shows a candidate version that comes from repo.mongodb.org.
apt-cache policy mongodb-orgConfirmed by mongodb.com
Cause 2 of 3
The Ubuntu release or CPU is not one MongoDB supports
1Check
MongoDB 8.0 on Ubuntu lists 64-bit LTS releases only: 24.04, 22.04 and 20.04, on x86_64 and on selected ARM64 platforms. Anything outside that list, such as a non-LTS release or a 32-bit system, is not covered by the guide, so do not expect packages.
cat /etc/lsb-release
dpkg --print-architecture2Fix
Use a supported 64-bit LTS release. On an unsupported machine, run MongoDB in another way, for example on a supported host or in a container, instead of forcing the repository.
# Supported codenames in the repository line: noble, jammy, focal3Verify
On a supported release, apt-cache policy lists a candidate from repo.mongodb.org.
apt-cache policy mongodb-orgConfirmed by mongodb.com
Cause 3 of 3
The repository line names a different codename than your Ubuntu release
1Check
The line contains the Ubuntu codename and the MongoDB series. For Jammy or Focal you replace noble in the line with jammy or focal. A line copied from another guide may name the wrong one.
cat /etc/apt/sources.list.d/mongodb-org-8.0.list
lsb_release -cs2Fix
Rewrite the file so the codename in it matches your release, then reload the package lists.
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
sudo apt-get update3Verify
apt-cache policy mongodb-org shows a candidate.
apt-cache policy mongodb-orgConfirmed by mongodb.com
How do I stop it coming back?
- Follow the installation page for your exact MongoDB series and add the repository file it names, instead of reusing a line from an older server.
- Run apt-get update every time you add or edit a file in /etc/apt/sources.list.d/.
- Do not install Ubuntu's own mongodb package next to mongodb-org: MongoDB says the two conflict, so remove it first.
- Pick a supported 64-bit LTS release for new MongoDB servers.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Servers
apt update refuses the MongoDB repository because of a GPG signature error
E: The repository 'https://repo.mongodb.org/apt/ubuntu <release>/mongodb-org/9.0 Release' is not signed.
apt rejects the MongoDB repository when it has no copy of MongoDB's public key.
2 causes, each with a fixServers
dnf cannot install MySQL on Amazon Linux 2023
dnf cannot find a mysql-server package on Amazon Linux 2023
Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.
3 causes, each with a fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fix