MongoDB 在 Ubuntu 22.04 上安装失败 - 依赖于 libssl1.1 但无法安装

MongoDB 在 Ubuntu 22.04 上安装失败 - 依赖于 libssl1.1 但无法安装

以下是网站上的标准安装说明:

wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt 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.1 (>= 1.1.1) but it is not installable
 mongodb-org-server : Depends: libssl1.1 (>= 1.1.1) but it is not installable
 mongodb-org-shell : Depends: libssl1.1 (>= 1.1.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

我尝试直接安装依赖项,但似乎并没有解决问题:

sudo apt install libssl1.1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libssl1.1 is already the newest version (1.1.0g-2ubuntu4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

编辑 2022 年 12 月

MongoDB 6.0 现在可以从 Jammy 上的 mongodb 存储库安装,无需 libssl1.1

原始答案

MongoDb 目前还没有针对 ubuntu 22.04 的官方版本。

Ubuntu 22.04已升级libssl到3,不建议使用libssl1.1

您可以通过添加 ubuntu 20.04 源来强制安装 libssl1.1:

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-get install libssl1.1

然后使用你的命令安装 mongodb-org。

然后删除刚刚创建的焦点安全列表文件:

sudo rm /etc/apt/sources.list.d/focal-security.list

答案2

Ubuntu 22.04 还没有官方的 MongoDB 软件包,所以现在最好的选择是使用 Ubuntu 20.04,其中有官方的 MongoDB 软件包。

不推荐在 Ubuntu 22.04 中使用任何解决方法来安装 MongoDB,因为如果您要在生产中使用它,它可能会导致问题。以下是对我有用的解决方法:

  1. libssl1.1_1.1.1f-1ubuntu2_amd64.deb从官方存储库下载:

    wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
    
  2. 安装:

    sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
    
  3. 继续安装 MongoDB:

    sudo apt-get install -y mongodb-org
    

该解决方案来自MongoDB 论坛,但我还添加了一些需要记住的注释。

答案3

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo dpkg -i ./libssl1.1_1.1.0g-2ubuntu4_amd64.deb
rm -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb

答案4

@耶胡达建议libssl1.1_1.1.0g的不符合依赖性标准>=1.1.1。扩展该方法后,我尝试了以下方法,并且成功了。

根据提供的软件包ubuntu 上的 libssl

  • 仿生 (18.04LTS)(libdevel):安全套接字层工具包 - 开发文件
    • 1.1.1-1ubuntu2.1~18.04.17 [安全]: amd64 i386
    • 1.1.0g-2ubuntu4 [端口]: arm64 armhf ppc64el s390x
  • 仿生更新(libdevel):安全套接字层工具包 - 开发文件
    • 1.1.1-1ubuntu2.1~18.04.17:amd64 arm64 armhf i386 ppc64el s390x
  • 焦距 (20.04LTS)(libdevel):安全套接字层工具包 - 开发文件
    • 1.1.1f-1ubuntu2.13 [安全]: amd64 i386
    • 1.1.1f-1ubuntu2 [端口]: arm64 armhf ppc64el s390x
  • 焦点更新(libdevel):安全套接字层工具包 - 开发文件
    • 1.1.1f-1ubuntu2.13:amd64 arm64 armhf i386 ppc64el s390x
  • 顽皮的(21.10)(libdevel):安全套接字层工具包 - 开发文件
    • 1.1.1l-1ubuntu1.3 [安全]: amd64 i386
    • 1.1.1l-1ubuntu1 [端口]: arm64 armhf ppc64el s390x
  • 顽皮的更新(libdevel):安全套接字层工具包 - 开发文件
    • 1.1.1l-1ubuntu1.3:amd64 arm64 armhf i386 ppc64el s390x

下载其中任何一个http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/

我选择libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb,因为我之前在 Impish(21.10) 中使用过它

cd ~/Downloads
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1_amd64.deb
sudo dpkg -i ./libssl1.1_1.1.1l-1ubuntu1_amd64.deb
rm -i libssl1.1_1.1.1l-1ubuntu1_amd64.deb

相关内容