Error installing mongodb , broken ubuntu dependency - mongodb

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!

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

The following packages have unmet dependencies: mongodb-org :

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.

While installing mongodb in kali linux, I get errors in apt-get

need help.
Trying to install Mongodb in kali linux 2, using the command
sudo apt-get install mongodb-org
but it always gives me the following error:
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
Depends: mongodb-org-tools but it is not going to be installed
I have tried installing those packages by themself, but couldn't be found in the repository of kali.
[1]: https://i.stack.imgur.com/Tz1bF.png
try Aptitude instead
sudo aptitude install mongodb-org
also did you try
sudo apt-get clean
sudo apt-get autoclean

Cannot reinstall postgresql - apt-get dependency errors

I previously could install postgresql but then I uninstalled and installed it again, now if I try:
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
This will appear:
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 : Depends: postgresql-9.4 but it is not going to be installed
postgresql-contrib : Depends: postgresql-contrib-9.4 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
What's wrong here?
I want to remodel starting from scratch. So what I did before:
sudo apt-get --purge remove postgresql
sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/
You may have a broken database. Try: sudo apt-get --fix-broken
Alternatively, it may be that there are files left behind that are conflicting with version 9.4 of postgresql. If you can, install the version of postgresql you had before, then, using dpkg-query -L <package_name>, you can see what files were installed and what you may have left behind.
run the following.
sudo apt install aptitude && sudo aptitude install postgresql postgresql-contrib