Unable to locate package mongodb-org

A few days back, when I was installing MongoDB in the Ubuntu operating system. I got the error “unable to locate package mongodb-org“.

In this blog, I will explain how I managed to resolve the error “unable to locate package mongodb-org”.

  • Unable to locate package mongodb-org
  • Reason: unable to locate package mongodb-org
  • Solution: unable to locate package mongodb-org
  • Conclusion

Unable to locate package mongodb-org

Recently, When I was trying to install MongoDB in the Ubuntu operating system. I got this error “unable to locate package mongodb-org“. I was performing this on Ubuntu 20.04. You can see the error in the below image:

unable to locate package mongodb-org
unable to locate package mongodb-org

Reason: unable to locate package mongodb-org

To find the reason behind getting this error, I searched a lot on the web. Some said that the command we are using for downloading the MongoDB is for the unofficial package provided by Ubuntu and that is also not maintained by MongoDB.

Some said that you have to check all these:

  1. Check the package name
  2. Update the repository cache
  3. Check if package is available for your Ubuntu version

Also, Read: MongoDB is not recognized as an internal or external command

Solution: unable to locate package mongodb.org

When I was trying to troubleshoot this error. I found the solution that, we need to use the update command:

sudo apt-get update

This command builds the local cache of available packages. After that, you need to follow the below command to install MongoDB.

sudo apt-get install -y mongodb

The above command will install the MongoDB database.

unable to locate package mongodb-org in ubuntu
Resolve the error – unable to locate package mongodb-org

Here, you can see this time we don’t face any error and successfully installed the MongoDB database in the Ubuntu operating system.

Note that, when you install an application always use the apt-get update command because

  • It is used to download package information from all configured sources.
  • Sources defined in /etc/apt/sources
  • The update command downloads the package information from the internet.

Read: MongoDB shutting down with code 100

Conclusion

After resolving the error, I can say that the reason behind getting the error is not using the update command. The packages were not in the cache so we were not able to install them that is why we are getting errors.

Thus, you might have learned the cause and the solution of the error “unable to locate package mongodb-org”.

You may also like to read the following MongoDB tutorials.