我无法安装 mongodb:E:无法找到包 mongodb-org

I can’t install mongodb: E: Unable to locate package mongodb-org

我一直在尝试在 official documentation 之后安装 mongodb。所以我遵循了这些步骤:

第 1 步:

wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -

第 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

第 3 步:

sudo apt-get update

当我到达这一步时:

第 4 步:

sudo apt-get install -y mongodb-org

抛出此错误。

E: Unable to locate package mongodb-org

我在网上查了好几次都没有找到解决方法;

经过一些研究,我发现这个 大多数答案都说我应该:

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.

但是,这似乎是一个过时的答案,它解释了当我尝试使用已安装的 mongodb 以这种方法进行 mongodump 时,它 did not work.


使用过时的方法后,这是已安装的mongodb信息。我知道它们已经过时了。

mongo --version
MongoDB shell version: 2.6.10

mongod --version
db version v2.6.10

这是系统信息。

hostnamectl
Operating System: Ubuntu 16.04.7 LTS
Kernel: Linux 4.4.0-210-generic
Architecture: x86-64

非常感谢任何帮助。

Xenial MongoDB 的最后一个版本是 MongoDB 4.4,如 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 所示。