mongodb 以下程序包具有未满足的依赖项:蒙哥组织:

8tntrjer  于 2023-02-07  发布在  Go
关注(0)|答案(4)|浏览(160)

我尝试使用命令sudo apt-get install -y mongodb-org在ubuntu16.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.
axr492tv

axr492tv1#

看看https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/上的MongoDB文档,它说要使用他们的包,而不是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
kse8i1jr

kse8i1jr2#

如果其他人纠结于这个问题,而所有其他的答案都不起作用...
这就是我的工作:

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

详细信息(运行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
wwtsj6pe

wwtsj6pe3#

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

58wvjzkj

58wvjzkj4#

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

sudo dpkg --configure -a

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

sudo dpkg --remove package-name

你现在可以走了。

相关问题