无法在Ubuntu上安装MongoDB。

5

尝试在Ubuntu上安装MongoDB,但无法解决问题。

按照以下文档进行操作:https://www.mongodb.com/docs/master/tutorial/install-mongodb-on-ubuntu/

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

我的Ubuntu上的结果(CLI输出):

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK

将MongoDB 6.0的apt源添加到Ubuntu的源列表中: echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse
  1. sudo apt-get update

结果(CLI输出):

et:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Ign:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 InRelease                           
Hit:3 http://packages.microsoft.com/repos/code stable InRelease                                     
Hit:4 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease                  
Hit:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release                             
Ign:6 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 InRelease                           
Hit:7 http://il.archive.ubuntu.com/ubuntu jammy InRelease                                           
Ign:8 https://ppa.launchpadcontent.net/upubuntu-com/xampp/ubuntu jammy InRelease 
Hit:9 http://il.archive.ubuntu.com/ubuntu jammy-updates InRelease   
Hit:11 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release                            
Hit:12 http://il.archive.ubuntu.com/ubuntu jammy-backports InRelease                                
Err:13 https://ppa.launchpadcontent.net/upubuntu-com/xampp/ubuntu jammy Release  
  404  Not Found [IP: 185.125.190.52 443]
Reading package lists... Done
W: http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/4.0/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
E: The repository 'https://ppa.launchpadcontent.net/upubuntu-com/xampp/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/6.0/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

安装MongoDB:

在终端中运行以下命令:sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
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-mongos : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
 mongodb-org-server : Depends: libcurl3 (>= 7.16.2) but it is not installable
                      Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
 mongodb-org-shell : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable
 mongodb-org-tools : Depends: libssl1.0.0 (>= 1.0.2~beta3) but it is not installable
E: Unable to correct problems, you have held broken packages.

uname -m

执行结果(CLI输出):

x86_64

lsb_release -a

结果(CLI输出):

No LSB modules are available.

Distributor ID: Ubuntu

Description:    Ubuntu 22.04 LTS

Release:    22.04

Codename:   jammy 
3个回答

9

晚上好,我遇到了和你一样的问题,基本上是缺少libssl1.1

我解决问题的方法是添加包含此库的存储库进行下载,在这种情况下,我使用了focal 存储库

在终端中使用以下命令将其添加到您的系统:

echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list

然后更新:

sudo apt-get update

最后安装该库:

sudo apt install libssl1.1

安装完成后尝试再次安装mongodb,如果成功了,我很高兴能够帮到你,如果问题仍然存在,我不知道如何帮助你 :(


它正在运行!!TX - TG___
我遇到了相同的错误。你的方法对我没有起作用。 - Andrew Shaban

1
最近在Ubuntu 20.04上出现了一个问题,gpg密钥无法正确加载。
导入公钥。
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
   --dearmor

创建一个列表文件,在其中通过“signed-by”添加mongodb-server-7.0.gpg文件的位置。
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list

sudo apt-get update

希望对你有用!

0

https://www.youtube.com/watch?v=TzJ8xppcxM4

我正在尝试使用lajunta频道,并进行了一些小修改。

sudo apt-key export 64C3C388 | sudo gpg.d --dearmour -o /etc/apt/keyrings/mongod.gpg

你必须找到keyrings目录,我的keyrings在apt中,可能与你的和视频中的不同。

然后切换到以下目录:

cd /etc/apt/sources.list.d

接下来,请按照网站上的安装文档进行操作。

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

sudo apt-get update

sudo apt-get install -y mongodb-org

希望这可以帮到你...


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接