Reason: unable to locate package mongodb-orgCheck the package name. Update the repository cache. Check if package is available for your Ubuntu version.
I faced same issue but fix it by the changing the package file section command. The whole step that i followed was:
At first try with this command: sudo apt-get install -y mongodb
This is the unofficial mongodb package provided by Ubuntu and it is not maintained by MongoDB and conflict with MongoDB’s offically supported packages.
If the above command not working then you can fix the issue by one of the bellow procedure:
#Step 1: Import the MongoDB public key
#In Ubuntu 18.*+, you may get invalid signatures. --recv value may need to be updated to EA312927.
#See here for more details on the invalid signature issue: [https://stackoverflow.com/questions/34733340/mongodb-gpg-invalid-signatures][1]
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
#Step 2: Generate a file with the MongoDB repository url
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
#Step 3: Refresh the local database with the packages
sudo apt-get update
#Step 4: Install the last stable MongoDB version and all the necessary packages on our system
sudo apt-get install mongodb-org
#Or
# The unofficial mongodb package provided by Ubuntu is not maintained by MongoDB and conflict with MongoDB’s offically supported packages. Use the official MongoDB mongodb-org packages, which are kept up-to-date with the most recent major and minor MongoDB releases.
sudo apt-get install -y mongodb
Hope this will work for you also. You can follow this MongoDB
Update
The above instruction will install mongodb 2.6 version, if you want to install latest version for Uubuntu 12.04
then just replace above step 2
and follow bellow instruction instead of that:
#Step 2: Generate a file with the MongoDB repository url
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list
If you are using Ubuntu 14.04
then use bellow step instead of above step 2
#Step 2: Generate a file with the MongoDB repository url
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
The true problem here may be if you have a 32-bit system. MongoDB 3.X was never made to be used on a 32-bit system, so the repostories for 32-bit is empty (hence why it is not found). Installing the default 2.X Ubuntu package might be your best bet with:
sudo apt-get install -y mongodb
Another workaround, if you nevertheless want to get the latest version of Mongo:
You can go to https://www.mongodb.org/downloads and use the drop-down to select "Linux 32-bit legacy"
But it comes with severe limitations...
This 32-bit legacy distribution does not include SSL encryption and is limited to around 2GB of data. In general you should use the 64 bit builds. See here for more information.
Try without '-org':
sudo apt-get install -y mongodb
Worked for me!
I'm running Ubuntu 14.04; and apt still couldn't find package; I tried all the answers above and more. The URL that worked for me is this:
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
Source: http://www.liquidweb.com/kb/how-to-install-mongodb-on-ubuntu-14-04/
All steps are correct just change the Step 4 as below
Command: sudo apt-get install mongodb
It has worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With