I received the same issue on Debian 10 (Buster) in 2021-07 after I was following the official MongoDB documentation for setting up an old Mongodb version (4.0) on a new Debian machine.
After following these steps you will have licurl3 along with libcurl4 installed at the same time. I haven't discovered any broken dependencies until now.
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.
So the issue is that Mongo requires explicitly libcurl3, but it is no longer supported in the latest Debian 10 version. However you can do the following:
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
Works like a charm!
EDIT: Here are some ansible tasks to automate this:
---
- 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