2

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 | http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg/main amd64 Packages
postgresql | 9.4+166bzr2 | http://in.archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages
Juan Antonio
  • 1,572
  • Run apt-cache madison postgresql | grep -vi sources, add the output to your question, let me know about the output ;) another thing: Do you have to install 9.6? – Ravexina Apr 17 '17 at 07:17
  • @Ravexina I have edited question. please check. And yes, I have to install postgres 9.6 because some one have already started project with 9.6 and i have to configure on my local. – Hiren patel Apr 17 '17 at 07:21
  • Are you sure you are running Xenial? it's seems you are on vivid! – Ravexina Apr 17 '17 at 07:33
  • Ohh. Sorry. I am on vivid. – Hiren patel Apr 17 '17 at 07:43
  • 1
    If you have look at here: http://apt.postgresql.org/pub/repos/apt/dists/ you will find out that vivid support does not provided by postgresql, neither with Ubuntu itself. upgrade ;) – Ravexina Apr 17 '17 at 07:56
  • then how do i install on vivid system ? – Hiren patel Apr 17 '17 at 08:33
  • I don't know, It's an outdated version which it's support has been ended at February 4, 2016. as I said you should upgrade to a newer version. – Ravexina Apr 17 '17 at 08:36

3 Answers3

2

here are the easy terminal commands to install postgresql try this instead

     $ sudo apt-get update
     $ sudo apt-get install postgresql postgresql-contrib
1

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
1

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 http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | 
sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6