1

I am following https://www.postgresql.org/download/linux/redhat/ to install postgrsql 9.4 on Centos 7, using the command:

yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm

This gives output:

[root@localhost /]# yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
Loaded plugins: fastestmirror
pgdg-centos94-9.4-3.noarch.rpm                           | 5.4 kB     00:00     
Examining /var/tmp/yum-root-6jRPAn/pgdg-centos94-9.4-3.noarch.rpm: pgdg-centos94-9.4-3.noarch
/var/tmp/yum-root-6jRPAn/pgdg-centos94-9.4-3.noarch.rpm: does not update installed package.
Error: Nothing to do

Then, I run yum install postgresql94, which gives:

Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * epel: mirror.premi.st
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
No package postgresql94 available.
Error: Nothing to do

How can I install postgresql 9.4 on CentOS 7?

  • Looks like you a version of postgresql already installed. Run "yum info postgresql" to verify. Then remove the current version before running the initial yum install command with the http link. You will in effect downgrade your currently installed version. – Raman Sailopal May 29 '18 at 12:47
2

Did you update the cache with yum makecache fast ? Because on a clean system this makes postgres 9.4 available:

# yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
# yum makecache fast
...
pgdg94                                                   | 4.1 kB     00:00
...
# yum -y list | sort > yl
# grep -i postgresql yl | grep -v base
...
# yum info postgresql94
...

(I keep a yl file around for easy grepping.)

  • After running these commands, still does cannot install postgresql 9.4. – codezombie May 30 '18 at 4:32
  • In fact, by running I was able to reinstall postgresql94 but again I cannot install postgresql94 even after running yum makecache fast. – codezombie May 30 '18 at 4:50
1

First of all try to find what packages related to postgresql are installed. For this run below commands:

rpm -qa|grep postgres

Above command will give a list of installed packages.

Now remove each of the listed packages one by one by giving below command:

rpm -e <package-name>

         OR

yum remove <package-name>

After removing all the listed packages, try installing postgresql-9.4 the same way you were trying to install as mentioned in question.

0

Go to postgresql download site and select desired postgresql version and your distribution and architecture (In this case, 9.4, CentOS 7, and x86_64, respectively). Then a command appears you need to run to install postgresql94:

yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm

In the above statement, change install to reinstall and run it:

yum reinstall https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm   

You will then be able to successfully run:
yum install postgresql94

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.