Centos 7 に postgresql 9.4 をインストールできない

Centos 7 に postgresql 9.4 をインストールできない

私はフォローしています参考:次のコマンドを使用して、Centos 7 に postgrsql 9.4 をインストールします。

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

出力は次のようになります。

[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

次に、 を実行するとyum install postgresql94、次のようになります。

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

CentOS 7 に postgresql 9.4 をインストールするにはどうすればよいですか?

答え1

キャッシュを更新しましたかyum makecache fast? クリーンなシステムでは、これにより postgres 9.4 が利用可能になります。

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

(yl簡単に grep できるようにファイルを保存しています。)

答え2

まず、postgresql に関連するどのパッケージがインストールされているかを調べます。そのためには、以下のコマンドを実行します。

rpm -qa|grep postgres

上記のコマンドを実行すると、インストールされているパッケージのリストが表示されます。

以下のコマンドを実行して、リストされている各パッケージを 1 つずつ削除します。

rpm -e <package-name>

         OR

yum remove <package-name>

リストされているすべてのパッケージを削除した後、質問で述べたインストールと同じ方法で postgresql-9.4 をインストールしてみてください。

答え3

postgresqlのダウンロードへサイト希望する postgresql のバージョンとディストリビューションおよびアーキテクチャ (この場合はそれぞれ 9.4、CentOS 7、x86_64) を選択します。次に、postgresql94 をインストールするために実行する必要があるコマンドが表示されます。

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

上記のステートメントで、install をreinstall次のように変更して実行します。

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

その後、以下のコマンドを正常に実行できるようになります。
yum install postgresql94

関連情報