RHEL7.9にpostgresql11をインストールする。
まずは検索。
# yum info postgresql11 読み込んだプラグイン:langpacks, product-id, search-disabled-repos, subscription-manager エラー: 表示するパッケージはありません
みつからない。
# yum info postgresql 読み込んだプラグイン:langpacks, product-id, search-disabled-repos, subscription-manager 利用可能なパッケージ 名前 : postgresql アーキテクチャー : i686 バージョン : 9.2.24 リリース : 4.el7_8 -- 中略 -- 名前 : postgresql アーキテクチャー : x86_64 バージョン : 9.2.24 リリース : 4.el7_8 -- 中略 --
version11が登録されていない。
ググるとredhat7系にはpostgresql11が登録されていない、ということ。
posgresqlのREPO RPMSにリポジトリが公開されている。
早速やってみる。
今回はora2pgも必要なためAVAILABLE REPO RPMSとNONFREE REPOSITORYのRHEL7用を使う。
RHEL7のyumのリポジトリは以下の通り。
# ls /etc/yum.repos.d/ redhat.repo
リポジトリに登録する。
# rpm -ivh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm # rpm -ivh https://download.postgresql.org/pub/repos/yum/reporpms/non-free/EL-7-x86_64/pgdg-redhat-nonfree-repo-latest.noarch.rpm
AVAILABLE REPO RPMSとNONFREE REPOSITORYのrepoファイルが2つできている。
# ls /etc/yum.repos.d/ pgdg-redhat-all.repo pgdg-redhat-nonfree-all.repo redhat.repo
これでOK。
もう一度確認。
# yum info postgresql11
読み込んだプラグイン:langpacks, product-id, search-disabled-repos, subscription-manager
pgdg-common | 2.9 kB 00:00:00
pgdg10 | 3.6 kB 00:00:00
https://download.postgresql.org/pub/repos/yum/non-free/10/redhat/rhel-7Server-x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
他のミラーを試します。
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
One of the configured repositories failed (PostgreSQL 10 for RHEL/CentOS 7Server - x86_64 - NonFree),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=pgdg10-nonfree ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable pgdg10-nonfree
or
subscription-manager repos --disable=pgdg10-nonfree
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=pgdg10-nonfree.skip_if_unavailable=true
failure: repodata/repomd.xml from pgdg10-nonfree: [Errno 256] No more mirrors to try.
https://download.postgresql.org/pub/repos/yum/non-free/10/redhat/rhel-7Server-x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
なんだこれは!
https://download.postgresql.org/pub/repos/yum/non-free/10/redhat/rhel-7Server-x86_64/repodata/repomd.xml:
このリソースが404-not foundということ。
ファイルが無い。
「7Server」というのが怪しい。
RHEL7.9だから7.9なのでは?
名前を変えてwgetしてみる。
# wget https://download.postgresql.org/pub/repos/yum/non-free/10/redhat/rhel-7.9-x86_64/repodata/repomd.xml --2021-01-21 06:04:41-- https://download.postgresql.org/pub/repos/yum/non-free/10/redhat/rhel-7.9-x86_64/repodata/repomd.xml download.postgresql.org (download.postgresql.org) をDNSに問いあわせています... 147.75.85.69, 217.196.149.55, 72.32.157.246, ... download.postgresql.org (download.postgresql.org)|147.75.85.69|:443 に接続しています... 接続しました。 HTTP による接続要求を送信しました、応答を待っています... 200 OK 長さ: 3706 (3.6K) `repomd.xml' に保存中 100%[==================================================================================================>] 3,706 --.-K/s 時間 0s 2021-01-21 06:04:42 (210 MB/s) - `repomd.xml' へ保存完了 [3706/3706]
あった。
NONFREE REPOSITORYのリポジトリが間違っている…。
/etc/yum.repos.d/pgdg-redhat-nonfree-all.repoの中身を調べてみる。
[pgdg12-nonfree] name=PostgreSQL 12 for RHEL/CentOS $releasever - $basearch - NonFree baseurl=https://download.postgresql.org/pub/repos/yum/non-free/12/redhat/rhel-$releasever-$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG [pgdg11-nonfree] name=PostgreSQL 11 for RHEL/CentOS $releasever - $basearch - NonFree baseurl=https://download.postgresql.org/pub/repos/yum/non-free/11/redhat/rhel-$releasever-$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG -- 中略 --
yumリポジトリの変数$releaseverに7Serverが割り当てられているのが原因だ。
AVAILABLE REPO RPMSの方はOKなので、NONFREE REPOSITORYのリポジトリだけ7.9がはいるようにしたい。
pgdg-redhat-nonfree-all.repoの$releaseverを全て$releasevernonfreeに変えて、この変数に7.9を設定しよう。
[pgdg12-nonfree] name=PostgreSQL 12 for RHEL/CentOS $releasevernonfree - $basearch - NonFree baseurl=https://download.postgresql.org/pub/repos/yum/non-free/12/redhat/rhel-$releasevernonfree-$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG [pgdg11-nonfree] name=PostgreSQL 11 for RHEL/CentOS $releasevernonfree - $basearch - NonFree baseurl=https://download.postgresql.org/pub/repos/yum/non-free/11/redhat/rhel-$releasevernonfree-$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG -- 中略 --
内容が7.9の変数ファイルを作成。
# echo 7.9 > /etc/yum/vars/releasevernonfree # cat /etc/yum/vars/releasevernonfree 7.9
やってみる。
# yum info postgresql11
読み込んだプラグイン:langpacks, product-id, search-disabled-repos, subscription-manager
利用可能なパッケージ
名前 : postgresql11
アーキテクチャー : x86_64
バージョン : 11.10
リリース : 1PGDG.rhel7
容量 : 1.7 M
リポジトリー : pgdg11/7Server/x86_64
要約 : PostgreSQL client programs and libraries
URL : https://www.postgresql.org/
ライセンス : PostgreSQL
説明 : PostgreSQL is an advanced Object-Relational database management system (DBMS).
: The base postgresql package contains the client programs that you'll need to
: access a PostgreSQL DBMS server, as well as HTML documentation for the whole
: system. These client programs can be located on the same machine as the
: PostgreSQL server, or on a remote machine that accesses a PostgreSQL server
: over a network connection. The PostgreSQL server can be found in the
: postgresql11-server sub-package.
:
: If you want to manipulate a PostgreSQL database on a local or remote PostgreSQL
: server, you need this package. You also need to install this package
: if you're installing the postgresql11-server package.
できた。