如何使用 libcurl4 安装 mongodb?

How to Install mongod with libcurl4?

Debian10升级到libcurl4导致mongo服务器安装失败。是否可以使用 libcurl4 运行 mongod?

在执行 mongod 二进制文件时,我得到 /usr/bin/mongod: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found([=16= 要求]).

在尝试安装 libcurl3 时,我收到 libcurl4 替换它的消息。

这个问题已经过时了。现在有可用的 Debian10 版本。

(旧答案) 现在,只需使用为 Ubuntu 18.4 构建的版本 访问 https://www.mongodb.com/try/download/community 并下载 Ubuntu 18.4 版本。 Ubuntu 基于 Debian 测试,因此使用该版本应该没有问题。 Mongo 可能会很快更新他们的 Debian 版本。那么你可以安装Debian10

同一个 link.

中已经有可用的 Debian 10 版本

下载后可以使用这个命令安装(前提是你的shell和下载的包在同一个文件夹):

sudo dpkg -i mongodb-org-server*.deb

另一种解决库依赖性问题的方法是使用 docker 容器。

例如,在那种情况下,安装 docker-ce 后,您可以 运行 像这样:

docker run -d --name mongo-4.0.9  -p 127.0.0.1:27017:27017  --restart unless-stopped -v /var/lib/mongodb:/data/db mongo:4.0.9 

这样,您就不会依赖于您的系统依赖性。

希望对您有所帮助。

我在遵循 MongoDB 官方文档以在新的 Debian 机器。

完成这些步骤后,您将同时安装 licurl3 和 libcurl4。直到现在我还没有发现任何损坏的依赖项。

root@mongo21-1 ➜  sources.list.d  cat <<EOF > /etc/apt/sources.list.d/mongodb_org_deb.list
deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main
EOF


root@mongo21-1 ➜  sources.list.d  apt update



root@mongo21-1 ➜  sources.list.d  apt install -y mongodb-org-server
Reading package lists... Done
Building dependency tree
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-server : Depends: libcurl3 (>= 7.16.2) but it is not installable
E: Unable to correct problems, you have held broken packages.


所以问题是 Mongo 需要明确的 libcurl3,但在最新的 Debian 10 版本中不再支持它。但是您可以执行以下操作:

root@ecollect-mongo21-1 ➜  sources.list.d  cat <<EOF > /etc/apt/sources.list.d/oldstable.list
deb http://security.debian.org/ oldstable/updates main
EOF

root@mongo21-1 ➜  sources.list.d  apt update

root@mongo21-1 ➜  sources.list.d  apt install -y libcurl3/oldstable

root@mongo21-1 ➜  sources.list.d  apt install -y mongodb-org-server

很有魅力!

编辑:这里有一些自动化的任务:

---

  - name: Ensure deb keyring for mongodb
    apt_key:
      state: present
      url: https://www.mongodb.org/static/pgp/server-4.0.asc





  - name: Ensure mongodb deb source
    apt_repository:
      filename: /etc/apt/sources.list.d/repo-mongodb_org-debian-apt
      state: present
      repo: "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main"




  - name: Ensure libcurl3 source
    apt_repository:
      filename: /etc/apt/sources.list.d/oldstable.list
      state: present
      repo: "deb http://security.debian.org/ oldstable/updates main"





  - name: Install packages - mongodb-org-server
    apt:
      name: mongodb-org-server
      state: present


  - name: Install packages - mongodb-org-shell
    apt:
      name: mongodb-org-shell
      state: present


  - name: Install packages - mongodb-org-tools
    apt:
      name: mongodb-org-tools
      state: present