I have been trying to install mongodb following the official documentation. So I followed these steps:
STEP 1:
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
STEP 2:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
STEP 3:
sudo apt-get update
When I reach this step:
STEP 4:
sudo apt-get install -y mongodb-org
This error gets thrown.
E: Unable to locate package mongodb-org
I looked it up all over the internet and I couldn't find any solution even though it has been asked several times;
After doing some research, I have found this stackoverflow question where most answers say that I should just:
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.
But, this seems to be an outdated answer which explains when I tried to do mongodump using the installed mongodb with that approach, it did not work.
After using the Outdated approach, this the installed mongodb info. I do understand they're outdated.
mongo --version
MongoDB shell version: 2.6.10
mongod --version
db version v2.6.10
This is the system info.
hostnamectl
Operating System: Ubuntu 16.04.7 LTS
Kernel: Linux 4.4.0-210-generic
Architecture: x86-64
I would really appreciate any help.
CodePudding user response:
The last release of MongoDB for Xenial was MongoDB 4.4, as seen in the software's repository for Xenial. Thus, you won't be able to install MongoDB 5.0 (I assume that's what you are trying to do) from the official repository; however you can install the software using a .tgz Tarball
, as specified in Install MongoDB Community on Ubuntu using .tgz Tarball.