2 / 2
Jul 2024

~$ sudo apt-get install -y mongodb-org
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
mongodb-org : Depends: mongodb-org-database but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Hi there!

Since there wasn’t a reply to your message, I tried to run it by our documentation bot. Here is the response I got :slight_smile:


To resolve the issue of unmet dependencies and broken packages when installing MongoDB on Ubuntu, you can try the following steps:

  1. Update the package lists and upgrade the system packages:
sudo apt-get updatesudo apt-get upgrade
  1. Remove any existing MongoDB packages:
sudo apt-get purge mongodb-org*
  1. Clean the package cache:
sudo apt-get clean
  1. Install the required dependencies:
sudo apt-get install -y libcurl4 openssl liblzma5
  1. Install MongoDB Community Edition:
sudo apt-get install -y mongodb-org

If you still encounter the same error, it’s possible that there are conflicting packages or other issues with your system. In that case, you may need to troubleshoot further or seek assistance from the MongoDB community or support channels.

Please note that the provided steps are general recommendations and may not address all possible issues. It’s always a good idea to consult the official MongoDB documentation or seek assistance from the MongoDB community for specific installation issues.

Related resources: