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
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:
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:
- Check the package name
- Update the repository cache
- 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.
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
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.
- How to drop a database in MongoDB
- Export MongoDB to CSV
- MongoDB join two collections
- How to install MongoDB
- MongoDB two-phase commit
- Missing before statement MongoDB
- How to create new database in MongoDB
- How does MongoDB create collection
- Sub-process /usr/bin/dpkg returned an error code (1)
I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.
Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.