E: Unable to locate package mongodb-org

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 have faced the same issue but then fixed it by the changing the package file section command. The steps that I followed were:

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 conflicts with MongoDB’s officially supported packages.

If the above command doesn't work then you can fix the issue by one of the following procedures:

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: MongoDB GPG - Invalid Signatures

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 if the unofficial mongodb package provided by Ubuntu is not maintained by MongoDB and conflict with MongoDB’s officially 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 Ubuntu 12.04 then just omit the above step 2 and follow below 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