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
Related
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
I need to run a shell script on my new Ubuntu machine in AWS which has the following command:
sudo apt-get install postgresql postgresql-contrib
But, due to some restrictions, I don't want to go to internet to do that. So, I downloaded the below two .debs and scp them to the box.
postgresql_12+213.pgdg18.04+1_all.deb
postgresql-contrib_12+213.pgdg18.04+1_all.deb
And , in the shell script, I replaced the above command with the below:
sudo dpkg -i postgresql_12+213.pgdg18.04+1_all.deb
sudo dpkg -i postgresql-contrib_12+213.pgdg18.04+1_all.deb
Now, while executing the script, i got the below error:
(Reading database ... 56588 files and directories currently installed.)
Preparing to unpack postgresql_12+213.pgdg18.04+1_all.deb ...
Unpacking postgresql (12+213.pgdg18.04+1) ...
dpkg: dependency problems prevent configuration of postgresql:
postgresql depends on postgresql-12; however:
Package postgresql-12 is not installed.
dpkg: error processing package postgresql (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
postgresql
Selecting previously unselected package postgresql-contrib.
(Reading database ... 56591 files and directories currently installed.)
Preparing to unpack postgresql-contrib_12+213.pgdg18.04+1_all.deb ...
Unpacking postgresql-contrib (12+213.pgdg18.04+1) ...
dpkg: dependency problems prevent configuration of postgresql-contrib:
postgresql-contrib depends on postgresql-contrib-12; however:
Package postgresql-contrib-12 is not installed.
dpkg: error processing package postgresql-contrib (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
postgresql-contrib
So, I tried to individually run the below command (just to check, as they work perfectly fine on my local ubuntu machine) which I believe goes to the internet:
sudo apt-get install postgresql postgresql-contrib
I get the below error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql-contrib is already the newest version (12+213.pgdg18.04+1).
postgresql is already the newest version (12+213.pgdg18.04+1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
postgresql : Depends: postgresql-12 but it is not installable
postgresql-contrib : Depends: postgresql-contrib-12 but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I am not very good with linux, but in the error above, I see it says that postgresql is already on the newest version. But when I try to run the below commands, they dont work:
postgres --version
postgres -V
locate /bin/postgres
psql --version
It seems postgres is not pre-installed on the machine. So, my issue here is I need to run the below command without internet access ( for which I downloaded the deb and tried but didnt work)
sudo apt-get install postgresql postgresql-contrib
Try updating your ubuntu and then install the packages again -
sudo apt-get update -y && sudo apt-get upgrade -y
Then install postgresql -
sudo apt-get install postgresql postgresql-contrib -y
Hope it helps.
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.
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!
I have to change my databasefrom MySQL to postgreSQL in django. But postgreSQL is not installing .
Error while installing postgreSQL using commands-
sudo apt-get update && sudo apt-get upgrade
sudo apt-get purge postgresql*
sudo apt-get -f install
sudo apt-get install postgresql
At terminal-
(jango)dc#dc-comp-4:~/website$ sudo apt-get install postgresql
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.3 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
but its not working.how can i do this.and what changes i have to made. Plz help