以下软件包具有未满足的依赖项:mongodb-org :



在产生以下错误后,我正在尝试使用sudo apt-get install -y mongodb-orgubuntu 16.04 上的命令安装 Mongodb:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mongodb-org : Depends: mongodb-org-shell but it is not going to be installed
Depends: mongodb-org-server but it is not going to be installed
Depends: mongodb-org-mongos but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

查看MongoDB文档 https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/它说使用他们的软件包而不是Ubuntu APT软件包。

以下是使用MongoDB包的步骤...

添加 APT 密钥:

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

添加 APT 源列表:

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list

更新 APT:

sudo apt-get update

安装 MongoDB 社区版包:

sudo apt-get install -y mongodb-org

启动服务:

sudo service mongod start

使用 mongoshell 登录数据库:

mongo

如果其他人在这个问题上挣扎并且所有其他答案都不起作用......

这是对我有用的:

apt-get install mongodb-org-shell
apt-get install mongodb-org-server
apt-get install mongodb-org-mongos

然后又一次

sudo apt-get install -y mongodb-org

Detials (run uname -a(:

Linux resta-dev 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

当选择了错误的 Ubuntu 版本时,我遇到了这个问题。确保仔细检查是否运行正确的版本。

使用此命令显示已安装的应用程序及其导致问题的依赖项:

sudo dpkg --configure -a

并使用以下命令并将package-name替换为需要删除的软件包的名称

sudo dpkg --remove package-name

你现在可以走了。

在安装官方mongodb-org软件包之前,您的系统已经安装了 Ubuntu MongoDB 软件包。要确认主机是否安装了 Ubuntumongodb软件包,请运行;

sudo apt list --installed | grep mongo

如果存在,则需要通过运行删除所有已安装的mongodb-org包;

sudo apt remove mongo*

删除所有MongoDB packages后,您现在可以使用官方安装指南完成安装

最新更新