CentOS 9にpostgreSQL 14を入れる!postGIS 3.2も入れる!

Pocket

以前に自分でインストールしたやり方を参考に、インストールを試みようとしてみたのですが、やはり少し変わったパッケージをLinuxへインストールするには何かが引っ掛かります(^^;

ということで、以下の環境にインストールを行っていきます。

OS:Rocky Linux 9
インストール対象:postgreSQL 14 + postGIS 3.2

PostgreSQL インストール

前回学んだ本家サイトからインストール方法を確認します。

https://www.postgresql.org/download/linux/redhat/

こちらのサイトにあるインストール方法を真似するだけです。

以下に提示されたコマンドを記します。

sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf -qy module disable postgresql
sudo dnf install -y postgresql14-server
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
sudo systemctl enable postgresql-14
sudo systemctl start postgresql-14

順番に説明しておきます。

リポジトリを追加

リポジトリを追加します。

dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm

既存のPostgreSQLを無効にする。

インストールしていない時には不要の作業となります。
過去にPostgreSQLをインストールしている場合のも必要な作業になります。

ある意味、トランザクション対象のパッケージを維持したまま、本体だけを無効にするという感じなんでしょうかね。
#違うところで参考になりそうです。

dnf -qy module disable postgresql

PostgreSQLをインストール

PostgreSQLをインストールします。

dnf install -y postgresql14-server

インストールはこれで完了です。

起動設定

自動で起動するように設定します。

/usr/pgsql-14/bin/postgresql-14-setup initdb
systemctl enable postgresql-14
systemctl start postgresql-14

インストールとPostgreSQLの起動は完了しました。

PostGIS インストール

ここからが課題のPostGISインストール作業です。

まず、インストールしたPostgreSQLのバージョンに対応するPostGISのバージョンを下記のサイトで確認します。

https://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS

対応表からインストール対象のPostGISを確認します。
今回は、PostGIS 3.2を選択することにしました。

システムのリポジトリに含まれるPostGISのバージョンを確認します。

dnf list | grep -i postgis
postgis32_13.x86_64                                       3.2.2-1.rhel9                                     pgdg13
postgis32_13-client.x86_64                                3.2.2-1.rhel9                                     pgdg13
postgis32_13-devel.x86_64                                 3.2.2-1.rhel9                                     pgdg13
postgis32_13-docs.x86_64                                  3.2.2-1.rhel9                                     pgdg13
postgis32_13-gui.x86_64                                   3.2.2-1.rhel9                                     pgdg13
postgis32_13-utils.x86_64                                 3.2.2-1.rhel9                                     pgdg13
postgis32_14.x86_64                                       3.2.2-1.rhel9                                     pgdg14
postgis32_14-client.x86_64                                3.2.2-1.rhel9                                     pgdg14
postgis32_14-devel.x86_64                                 3.2.2-1.rhel9                                     pgdg14
postgis32_14-docs.x86_64                                  3.2.2-1.rhel9                                     pgdg14
postgis32_14-gui.x86_64                                   3.2.2-1.rhel9                                     pgdg14
postgis32_14-utils.x86_64                                 3.2.2-1.rhel9                                     pgdg14

今回インストールするバージョンは、postgis32_14であることが確認出来ますので、以下のコマンドでインストールを試みます。

dnf install postgis32_14

トランザクション関連のエラーが大量。。。ということで、問題の解決を行います。

dnf install epel-release
dnf --enablerepo=crb install flexiblas-netlib64
dnf install postgis32_14

これでインストール出来ました!

環境によって若干の違いがあるかと思いますが、参考になるかな?

以下のサイトが役に立ちました。
https://rockylinux.pkgs.org/9/rockylinux-crb-aarch64/flexiblas-netlib64-3.0.4-8.el9.aarch64.rpm.html

深くまで見ないといけないので、面倒ですが。。。

コメントを残す

メールアドレスが公開されることはありません。

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください