To install postgresql 9.6 on Ubuntu 15.04, I have followed steps from here and here
I am getting this error while installing.
Preparing to unpack .../postgresql-contrib_9.6+180.pgdg16.04+1_all.deb ... Unpacking postgresql-contrib (9.6+180.pgdg16.04+1) ... Setting up postgresql-9.6 (9.6.2-1.pgdg16.04+1) ... Can't locate PgCommon.pm in @INC (you may need to install the PgCommon module) (@INC contains: /usr/share/postgresql-common /usr/local/lib/perl5/site_perl/5.24.1/x86_64-linux /usr/local/lib/perl5/site_perl/5.24.1 /usr/local/lib/perl5/5.24.1/x86_64-linux /usr/local/lib/perl5/5.24.1 .). BEGIN failed--compilation aborted. dpkg: error processing package postgresql-9.6 (--configure): subprocess installed post-installation script returned error exit status 2 dpkg: dependency problems prevent configuration of postgresql-contrib-9.6: postgresql-contrib-9.6 depends on postgresql-9.6 (= 9.6.2-1.pgdg16.04+1); however: Package postgresql-9.6 is not configured yet. It is saying that Can't locate PgCommon.pm. I am not much familiar with perl modules. So I tried following to install PgCommon but not success.
cpan cpan >> install PgCommon Please help me get it installed. Thanks
Output of sudo apt-cache madison postgresql | grep -vi sources
postgresql | 9.6+180.pgdg16.04+1 | xenial-pgdg/main amd64 Packages postgresql | 9.4+166bzr2 | vivid/main amd64 Packages 73 Answers
here are the easy terminal commands to install postgresql try this instead
$ sudo apt-get update $ sudo apt-get install postgresql postgresql-contrib I have solved this problem on my machine. This error was blocking installation :
Can't locate PgCommon.pm in @INC (you may need to install the PgCommon module) (@INC contains: /usr/share/postgresql-common /usr/local/lib/perl5/site_perl/5.24.1/x86_64-linux /usr/local/lib/perl5/site_perl/5.24.1 /usr/local/lib/perl5/5.24.1/x86_64-linux /usr/local/lib/perl5/5.24.1 .) I found out that due to perl dependencies it was failing to install. So I did run following command.
which perl >>>> /usr/local/lib/perl After some googling I found out that actual path should be /usr/bin/perl for successfull postgres installation. Perl was installed more than one time on my system. That was the problem. So I deleted directory :
sudo rm -rf /usr/local/lib/perl sudo rm -rf /usr/local/bin/perl After that I run following command to install postgres successfully.
sudo add-apt-repository "deb trusty-pgdg main" wget --quiet -O - | sudo apt-key add - sudo apt-get update sudo apt-get install postgresql-9.6 have been stuck on postgresql-client-9.6 : Depends: libpq5 (>= 9.6.10) but 9.5.14-0ubuntu0.16.04 is to be installed for several days.
Tried several solutions like the ones above, but always ended up with the error above. Finally solved it by
sudo aptitude install libpq5=11.0-1.pgdg16.04+2 sudo apt install -f postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6