95

Here are the standard installation instructions from the website:

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.

I tried installing the dependency directly but it doesn't seem to have fixed the issue:

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.
Pilot6
  • 90,100
  • 91
  • 213
  • 324

6 Answers6

109

Edit december 2022

MongoDB 6.0 is now installable from mongodb repositories on Jammy, without requiring libssl1.1

Original answer

MongoDb has no official build for ubuntu 22.04 at the moment.

Ubuntu 22.04 has upgraded libssl to 3 and does not propose libssl1.1

You can force the installation of libssl1.1 by adding the ubuntu 20.04 source:

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

Then use your commands to install mongodb-org.

Then delete the focal-security list file you just created:

sudo rm /etc/apt/sources.list.d/focal-security.list
Lionep
  • 1,295
  • 11
    Isn't it unsafe to add the entire security repo for a different Ubuntu version? – Aaron Franke May 01 '22 at 02:57
  • 2
    I've found no alternative at the moment. Anyway, because of the same concern I immediately deleted the repo entry after I installed the needed package... – Javier May 09 '22 at 16:38
  • 1
    Another alternative would be to install MongoDB as a Docker container, and forward the relevant ports. – Artur Meinild May 11 '22 at 10:49
  • Libssl1.1 allowed me to install RStudio on PopOS 22.04! – mccurcio May 11 '22 at 20:12
  • 1
    @Javier would you mind to add the command to remove the repo? – TheTanic Jun 02 '22 at 06:31
  • 2
    @TheTanic Just comment or delete the repo line in etc/apt/sources.list. – Javier Jun 02 '22 at 13:10
  • 1
    Delete the impish-security.list file in /etc/apt/sources.list.d/ post installation – BOT_bkcd Jun 26 '22 at 18:22
  • 4
    In my installation the repository "does not have a Release file.", and disables it. – JMCampos Aug 11 '22 at 08:25
  • 4
    Note the Impish repositories seem to be unavailable at the moment: you can just revert back to using Focal Fossa's:

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

    You could use any other release that hasn't reached its EOL (i.e. End Of Life) as seen here

    – Collado Sep 05 '22 at 09:05
  • 1
    The answer is incorrect. This is all you'll get from 22.04: E: The repository 'http://security.ubuntu.com/ubuntu impish-security Release' does not have a Release file. – Seamus Sep 15 '22 at 23:45
  • 1
    Thanks @Collado, I've updated the procedure with focal. – Lionep Sep 20 '22 at 15:55
  • Presumably, mongodb 4.4 still requires libssl1.1, correct? – Eli B. Dec 26 '22 at 16:19
  • You should probably consider picking the answer from @128KB which is the correct secure fix. – Sharcoux Jan 08 '23 at 15:48
  • As of January - there is no official release available for Ubuntu 22.04 at https://www.mongodb.com/try/download/community – fIwJlxSzApHEZIl Jan 10 '23 at 17:00
  • According to a comment on this post https://stackoverflow.com/a/76611493/11851843 using tee -a instead of tee prevents the apt source file being overwritten – Titus Buckworth Jul 04 '23 at 16:40
  • @TitusBuckworth focal-security.list is not a standard file especially on jammy version. So the tee command without the "-a" ensure it's the only line in file. Then the script can be run "safely" multiple times, where "tee -a" will append same line over and over. – Lionep Jul 17 '23 at 14:12
  • Thanks! I have used this same trick to install the libssl1.1 dependency for the now unsupported dotnet 5.0 SDK on Ubuntu 23.04. – Efran Cobisi Jul 31 '23 at 16:55
51

Ubuntu 22.04 doesn't have official MongoDB packages yet, so the best option now is to have Ubuntu 20.04, where official MongoDB packages are available.

It's NOT recommended to use any workaround in Ubuntu 22.04 to install MongoDB, because it can lead to problems if you gonna use it in production. Below is the workaround that worked for me:

  1. Download libssl1.1_1.1.1f-1ubuntu2_amd64.deb from official repository:

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

    sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
    
  3. Proceed with the installation of MongoDB:

    sudo apt-get install -y mongodb-org
    

This solution is from MongoDB Forum, but I also added a few notes to keep in mind.

Hayk
  • 623
27
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
16

the new official (and secure) fix for this is:

wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc |  gpg --dearmor | sudo tee /usr/share/keyrings/mongodb.gpg > /dev/null
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb.gpg ] 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 update
sudo apt install mongodb-org

edit: source

Artur Meinild
  • 26,018
128KB
  • 343
5

@yehuda suggested libssl1.1_1.1.0g which does not meet the dependency criteria >=1.1.1. Expanding on that approach, I tried the below and it worked.

Based on the packages provided by ubuntu for libssl

  • bionic (18.04LTS) (libdevel): Secure Sockets Layer toolkit - development files
    • 1.1.1-1ubuntu2.1~18.04.17 [security]: amd64 i386
    • 1.1.0g-2ubuntu4 [ports]: arm64 armhf ppc64el s390x
  • bionic-updates (libdevel): Secure Sockets Layer toolkit - development files
    • 1.1.1-1ubuntu2.1~18.04.17: amd64 arm64 armhf i386 ppc64el s390x
  • focal (20.04LTS) (libdevel): Secure Sockets Layer toolkit - development files
    • 1.1.1f-1ubuntu2.13 [security]: amd64 i386
    • 1.1.1f-1ubuntu2 [ports]: arm64 armhf ppc64el s390x
  • focal-updates (libdevel): Secure Sockets Layer toolkit - development files
    • 1.1.1f-1ubuntu2.13: amd64 arm64 armhf i386 ppc64el s390x
  • impish (21.10) (libdevel): Secure Sockets Layer toolkit - development files
    • 1.1.1l-1ubuntu1.3 [security]: amd64 i386
    • 1.1.1l-1ubuntu1 [ports]: arm64 armhf ppc64el s390x
  • impish-updates (libdevel): Secure Sockets Layer toolkit - development files
    • 1.1.1l-1ubuntu1.3: amd64 arm64 armhf i386 ppc64el s390x

Download any one of these from http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/

I choose libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb, since I used this previously in 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
  • 1
    libssl1.1_1.1.1l-1ubuntu1_amd64.deb is 404 Not Found but libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb worked for me and it's from 20.04 (Focal) which is the current officially supported MongoDB version. – Bart Jul 27 '22 at 21:55
0

I had to install libssl-dev 1.1.1l as well as libssl1.1.1l.

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
apt get update

wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.5_amd64.deb dpkg -i libssl1.1_1.1.1l-1ubuntu1.5_amd64.deb wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1l-1ubuntu1.5_amd64.deb dpkg -i libssl-dev_1.1.1l-1ubuntu1.5_amd64.deb

apt install -y mongodb-org

For those who are trying on Apple M1 Ubuntu vm like me, use the ARM binaries of Openssl like this:

wget http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.5_arm64.deb
dpkg -i libssl1.1_1.1.1l-1ubuntu1.5_arm64.deb
wget http://ports.ubuntu.com/pool/main/o/openssl/libssl-dev_1.1.1l-1ubuntu1.5_arm64.deb
dpkg -i libssl-dev_1.1.1l-1ubuntu1.5_arm64.deb