gpt4 book ai didi

mongodb - 无法在 ubuntu 18.04 LTS 上正确安装 mongodb

转载 作者:IT老高 更新时间:2023-10-28 13:14:41 25 4
gpt4 key购买 nike

我正在尝试在我的 Ubuntu 18.04 LTS 上安装 mongodb,但出现以下错误提示

You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: mongodb-org : Depends: mongodb-org-server but it is not going to be installed Depends: mongodb-org-mongos but it is not going to be installed Depends: mongodb-org-tools but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). umar@umar-Lenovo-ideapad-320-15ISK:~/Desktop/portfolio/async-demo$ sudo apt-get install -y mongodb

我相信这背后的原因已经在他们的网站上提到过,清楚地说

PLATFORM SUPPORT

MongoDB only provides packages for 64-bit LTS (long-term support) Ubuntu releases; for example, 14.04 LTS (trusty) and 16.04 LTS (xenial). See Supported Platforms for more information.

These packages may work with other Ubuntu releases; however, they are not supported.

那么如何在我最新的 Ubuntu 18.04 LTS 上安装 mongodb?为了清楚起见,我列出了我为纠正错误所做的事情:我跟着他们的官网安装了mongodb

1. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
2. echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
3. sudo apt-get update
4. sudo apt-get install -y mongodb-org

Now here I got errors saying: You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies:

我试过了,

apt --fix-broken install

它不起作用,我在某个地方找到了运行的线索

sudo apt -f install

它也返回错误。

Errors were encountered while processing: /var/cache/apt/archives/mongodb-org-server_4.0.0_amd64.deb /var/cache/apt/archives/mongodb-org-mongos_4.0.0_amd64.deb /var/cache/apt/archives/mongodb-org-tools_4.0.0_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

我认为主要问题是与版本的兼容性。所以基本上我有Ubuntu 18.04,我如何在这个版本上安装mongodb,这样我就可以毫无问题地工作了。

最佳答案

需要先卸载mongodb,才能使用:

sudo apt-get purge mongodb-org*

在此之后,通过以下命令安装 mongodb:

sudo apt-get install mongodb

然后更新:

sudo apt-get update

您已经完成了 mongodb 的安装。您可以使用以下命令进行检查:

mongo --version

关于mongodb - 无法在 ubuntu 18.04 LTS 上正确安装 mongodb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51417708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com