ThisisFish
ThisisFish

Reputation: 456

getting Error while installing mongodb in linux

   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: 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.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

I am getting this error even i did update the repo : sudo apt-get update

also i did check if there any broken packeges with : sudo apt-get check

step i took to install mongodb in linux: 1) sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

2) echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.6 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

3)sudo apt-get update

4)sudo apt-get install -y mongodb-org

but still getting the same error. how can i solve this?

Upvotes: 13

Views: 29139

Answers (8)

chovy
chovy

Reputation: 75656

Libssl has a CVE as of a month or so ago. We shouldn't be downgrading to older unpatched version of libssl to get mongodb 7.x to run on Ubuntu 22.04

Upvotes: 0

Sagar
Sagar

Reputation: 21

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

Upvotes: 2

Saad Fazal
Saad Fazal

Reputation: 11

Finally! Below Solutions worked for me

It is because of the missing dependencies mongodb not installing on ubuntu 22.04. The main reason is the missing of libssl1.1 dependency. So we need to install it seperately.

  1. sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

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

3.Go to root user sudo -i then paste this wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb

4.apt update

5.apt install libssl1.1

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

7.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

8.apt update

9.apt install -y mongodb-org

The latest version of mongodb will be installed To start it

1.systemctl enable mongod

2.systemctl start mongod

In case MongoDB doesn’t start run the command below to reload.

systemctl daemon-reload

code copied from https://www.mongodb.com/community/forums/t/installing-mongodb-over-ubuntu-22-04/159931/38

Upvotes: 1

Ermi
Ermi

Reputation: 106

100% working solution!!!

The below solution worked for me to install mongodb:

  1. Download 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

  1. Install it using the dpkg command:

sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb

Upvotes: 8

azam45
azam45

Reputation: 352


I guess this is the problem that you are facing. enter image description here

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

E: Unable to correct problems, you have held broken packages.

You can try the following steps to install mongodb in Ubuntu at any version:

sudo apt update

sudo apt upgrade

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

sudo apt-get update

sudo apt-get install -y mongodb-org

Now you may get the error like above screenshot. Try the following steps :

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1\~18.04.20_amd64.deb

sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb

Now, mongodb is ready to be installed. Run the following installation command again:

sudo apt-get install -y mongodb-org

To check Mongodb version, run the following command :

mongod --version

enter image description here

Upvotes: 14

Pradeep Kumbhare
Pradeep Kumbhare

Reputation: 71

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

After adding libssl1.1, follow mongoDB installation manual
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/

Upvotes: 7

Rohit Agrohia
Rohit Agrohia

Reputation: 418

I'm also getting the following error while installing MongoDB

 mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.0) but it is not 
 installable
 mongodb-org-server : Depends: libssl1.1 (>= 1.1.0) but it is not 
 installable
 mongodb-org-shell : Depends: libssl1.1 (>= 1.1.0) but it is not installable
 E: Unable to correct problems, you have held broken packages.

Here is the solution for this kind of issue Use the following command

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

sudo apt-get update
sudo apt-get install libssl1.1

Upvotes: 4

KNDheeraj
KNDheeraj

Reputation: 852

In my case, I'm using Linux Mint 17 -> Ubuntu 14.04 and I was installing with Ubuntu 16.04 resulting in this conflict.

Check your Ubuntu/Debian version - the wiki is a useful resource - before trying these commands.

If that doesn't solve it then run

sudo apt purge mongod* 
sudo apt purge mongodb* 
sudo apt purge mongodb-org* 

That should remove any inconsistency and then go to https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ and follow the procedure.

This resolved the issue.

Upvotes: 4

Related Questions