The following packages have unmet dependencies: mongodb-org : - mongodb

I am trying to install Mongodb using the command sudo apt-get install -y mongodb-org on ubuntu 16.04 after it produces the following error:
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 : Depends: mongodb-org-shell but it is not going to be installed
Depends: mongodb-org-server but it is not going to be installed
Depends: mongodb-org-mongos but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Looking at the MongoDB Documentation at https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ it says to use their package not the Ubuntu APT package.
Here are the steps to use the MongoDB Package in a nutshell...
Add the APT Key:
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
Add the APT Sources List:
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Update APT:
sudo apt-get update
Install the MongoDB Community Edition Package:
sudo apt-get install -y mongodb-org
Start the service:
sudo service mongod start
Log into the database using mongoshell:
mongo

If someone else struggle with this issue and all the other answers didn't work...
This is what work for me:
apt-get install mongodb-org-shell
apt-get install mongodb-org-server
apt-get install mongodb-org-mongos
And then again
sudo apt-get install -y mongodb-org
Detials (run uname -a):
Linux resta-dev 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I got this issue when the wrong Ubuntu version was selected. Make sure you double check that you run the correct one.

Your system already had the Ubuntu MongoDB package installed prior to installing the official mongodb-org packages. To confirm whether the host has the Ubuntu mongodb package installed, run;
sudo apt list --installed | grep mongo
If present you will need to remove all the installed mongodb-org packages by running;
sudo apt remove mongo*
Once all the MongoDB packages are removed you can now use the Official installation Guide to complete your installation

Use this command to display the installed applications and their dependencies causing troubles:
sudo dpkg --configure -a
and use the following command and replace package-name with the name of the package that need to be removed
sudo dpkg --remove package-name
You are now good to go.

Related

Unable to install mongodb in ubuntu 22.04 (mongodb-org, libssl1.1)

On following installation instructions from MongoDB official site.
While installing mongodb-org package getting the following error
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 libssl1.1 package using apt but I was unable to do so it throws following error.
E: Package 'libssl1.1' has no installation candidate
please someone help.
It seems mongodb require specific version of libssl1.1
you can download debian file of that version and install using following commands. Most probably it will resolve this issue.
sudo wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
After hours of looking for a solution I was satisfied with, I finally stumbled across one! Hope this helps anyone else looking to install MongoDB community edition without sacrificing security by using libssl1.1 (the solution here uses >3.0.
MongoDB has the repository for Ubuntu 22.04.1 LTS (Jammy Jellyfish) hidden away. It definitely still isn't on the documentation installation pages as of the time I am posting this. Check it out yourself: https://repo.mongodb.org/apt/ubuntu/dists/jammy/mongodb-org/
The following code will add the repository and install the latest mongodb-org on your system:
sudo apt-get install wget gpg
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | gpg --dearmor > packages.mongodb.gpg
sudo install -D -o root -g root -m 644 packages.mongodb.gpg /etc/apt/keyrings/packages.mongodb.gpg
echo "deb [ arch=amd64,arm64 signed-by=/etc/apt/keyrings/packages.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
rm -f packages.mongodb.gpg
sudo apt-get install -y mongodb-org

postgresql-13-postgis-3 : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed

I am trying to install the postgresql-13-postgis-3 package using following method on ubuntu 18.04 version. I have tried following method,
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo wget --no-check-certificate --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update -y; sudo apt install -y postgresql-13 postgresql-13-postgis-3 postgresql-13-postgis-3-scripts postgresql-13 postgresql-client-13
But I am getting following error,
postgresql-client-13 is already the newest version (13.5-1.pgdg18.04+1).
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:
postgresql-13-postgis-3 : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Can anyone suggest to me, how to install the postGIS in ubuntu 18.04? Any help will be highly appreciated.
The missing dependency is available in universe:
sudo add-apt-repository universe
sudo apt update
sudo apt install libgdal20

postgresql-client-13 : Depends: libpq5 (>= 13~beta2) but 12.3-1.pgdg18.04+1 is to be installed

I want to try new PostgreSQL and follow this instruction. But installation fails:
$ sudo apt install postgresql-client-13
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:
postgresql-client-13 : Depends: libpq5 (>= 13~beta2) but 12.3-1.pgdg18.04+1 is to be installed
E: Unable to correct problems, you have held broken packages.
I also tried this instruction to resolve unmet dependencies
What did I wrong and how to install psql 13?
UPD
Content of my sources.list.d:
kes#kes-X751SA /etc/apt/sources.list.d $ cat pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
kes#kes-X751SA /etc/apt/sources.list.d $ cat pgdg-testing.list
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg-testing main 13
Also:
$ sudo apt-cache policy postgresql-13
postgresql-13:
Installed: (none)
Candidate: 13~beta2-1.pgdg18.04+1
Version table:
13~beta2-1.pgdg18.04+1 100
100 http://apt.postgresql.org/pub/repos/apt bionic-pgdg-testing/13 amd64 Packages
Had the same problem.
in /etc/apt/sources.list.d/pgdg.list where you have
deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main
change it to
deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main 13
then run
sudo apt update
and then you can do
sudo apt install postgresql-13 postgresql-client-13
that worked on my machine.
Just FYI:
WARNING: The data format may change between beta releases. Be prepared
to pg_dump the database contents before you upgrade the package to a
newer beta or to a final release. Check the release notes before
upgrading.
try aptitude instead of apt-get
sudo apt-get install aptitude
sudo aptitude install <package-name>
https://askubuntu.com/a/1056378/1087086
Finally at my docker container I do next commands:
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install llvm5.0-devel
RUN yum -y install centos-release-scl-rh
RUN yum -y install llvm-toolset-7-clang
#RUN rpm -Uvh https://yum.postgresql.org/11/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm --replacepkgs
#RUN yum-config-manager --enable pgdg13-updates-testing
RUN yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
RUN yum -y install postgresql13 postgresql13-devel
Commented out lines were for case before 13.1 was released

Error installing mongodb , broken ubuntu dependency

Trying to install mongo with below command
rahul#rahul ~ $ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
mongodb-org is already the newest version (3.6.2).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
mongodb-org : Depends: mongodb-org-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I had this same issue installing mongodb-org on an Ubuntu 18 box.
The issue was that a version of mongodb was already installed, and it had to be removed before I continued.
The solution was to run the following:
sudo apt remove mongodb-org
sudo apt purge mongodb-org
sudo apt autoremove
sudo apt-get install mongodb-org
More info can be found on the Mongodb website - apparently this is a frequent enough issue that they had to address it there!

how to install mongodb on ubuntu 16.04.1?

I have used the instructions from the docs
after this command:
sudo apt-get install -y mongodb-org
I get this warning:
WARNING: The following packages cannot be authenticated!
mongodb-org-shell mongodb-org-server mongodb-org-mongos mongodb-org-tools mongodb-org
E: There were unauthenticated packages and -y was used without --allow-unauthenticated
Its instruction to start and test gives the following:
sudo service mongod start
cat /var/log/mongodb/mongod.log
cat: /var/log/mongodb/mongod.log: No such file or directory
As I mentioned in the comment, you could solve the problem by bypassing the gpg signature checks of apt using :
sudo apt-get --allow-unauthenticated install -y mongodb-org
You might want to have a look at more configuration options in detail along with right practices of using this appraoch here : https://askubuntu.com/questions/74345/how-do-i-bypass-ignore-the-gpg-signature-checks-of-apt
The mongodb docs have a great page on installing the latest mongo on Ubuntu. You can find it at: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
I'd recommend uninstalling mongodb and following the instructions on the previously mentioned page.