在CenoOS中选择不同版本的PostgreSQL并进行安装

首先

世界上有各种不同的应用程序,其中一些需要数据库(如PostgreSQL)。

在使用该应用程序时,有些要求指定数据库版本的情况,只有满足该版本要求才能正常运行。(有时由于准备工作或者版本不同,格式会有所不同)

因为源代码需要编译并使用会很麻烦,所以我想安装指定版本的软件包在CentOS上,但通常只有CentOS提供的选项。

因此,我将介绍从 PostgreSQL 存储库下载并使用的方法。

添加PostgreSQL存储库

在「https://yum.postgresql.org/」上有一个 yum 的 Repository 列表,您可以点击每个版本来安装用于添加仓库的RPM包。

执行以下命令以添加存储库。

# yum -y localinstall https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo
-latest.noarch.rpm
読み込んだプラグイン:fastestmirror, langpacks
pgdg-redhat-repo-latest.noarch.rpm                                                                       | 5.6 kB  00:00:00
/var/tmp/yum-root-4F7K7T/pgdg-redhat-repo-latest.noarch.rpm を調べています: pgdg-redhat-repo-42.0-4.noarch
/var/tmp/yum-root-4F7K7T/pgdg-redhat-repo-latest.noarch.rpm をインストール済みとして設定しています
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ pgdg-redhat-repo.noarch 0:42.0-4 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================================================================
 Package                        アーキテクチャー     バージョン             リポジトリー                                   容量
================================================================================================================================
インストール中:
 pgdg-redhat-repo               noarch               42.0-4                 /pgdg-redhat-repo-latest.noarch               6.8 k

トランザクションの要約
================================================================================================================================
インストール  1 パッケージ

合計容量: 6.8 k
インストール容量: 6.8 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告: RPMDB は yum 以外で変更されました。
  インストール中          : pgdg-redhat-repo-42.0-4.noarch                                                                  1/1
  検証中                  : pgdg-redhat-repo-42.0-4.noarch                                                                  1/1

インストール:
  pgdg-redhat-repo.noarch 0:42.0-4

确认要安装的软件包

执行以下命令后,将显示可安装版本的列表,确认要安装的版本后,使用yum命令进行安装。

# yum list |grep postgresql
freeradius-postgresql.x86_64                3.0.13-10.el7_6            updates
libreoffice-postgresql.x86_64               1:5.3.6.1-19.el7           base
pcp-pmda-postgresql.x86_64                  4.1.0-5.el7_6              updates
   :
   :
ostgresql94.x86_64                         9.4.24-1PGDG.rhel7         pgdg94
postgresql94-contrib.x86_64                 9.4.24-1PGDG.rhel7         pgdg94
postgresql94-debuginfo.x86_64               9.4.24-1PGDG.rhel7         pgdg94
   :
   :
postgresql10.x86_64                         10.10-1PGDG.rhel7          pgdg10
postgresql10-contrib.x86_64                 10.10-1PGDG.rhel7          pgdg10
postgresql10-debuginfo.x86_64               10.10-1PGDG.rhel7          pgdg10
   :
   :
postgresql11.x86_64                         11.5-1PGDG.rhel7           pgdg11
postgresql11-contrib.x86_64                 11.5-1PGDG.rhel7           pgdg11
postgresql11-debuginfo.x86_64               11.5-1PGDG.rhel7           pgdg11
   :
   :
postgresql96.x86_64                         9.6.15-1PGDG.rhel7         pgdg96
postgresql96-contrib.x86_64                 9.6.15-1PGDG.rhel7         pgdg96
postgresql96-debuginfo.x86_64               9.6.15-1PGDG.rhel7         pgdg96

安装软件包

执行以下命令来安装指定版本的PostgreSQL。

# yum -y install postgresql96*
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ postgresql96.x86_64 0:9.6.15-1PGDG.rhel7 を インストール
---> パッケージ postgresql96-contrib.x86_64 0:9.6.15-1PGDG.rhel7 を インストール
---> パッケージ postgresql96-debuginfo.x86_64 0:9.6.15-1PGDG.rhel7 を インストール
---> パッケージ postgresql96-devel.x86_64 0:9.6.15-1PGDG.rhel7 を インストール
---> パッケージ postgresql96-docs.x86_64 0:9.6.15-1PGDG.rhel7 を インストール
---> パッケージ postgresql96-libs.x86_64 0:9.6.15-1PGDG.rhel7 を インストール
---> パッケージ postgresql96-odbc.x86_64 0:11.01.0000-1PGDG.rhel7 を インストール
  :
  :
インストール:
  postgresql96.x86_64 0:9.6.15-1PGDG.rhel7                        postgresql96-contrib.x86_64 0:9.6.15-1PGDG.rhel7
  postgresql96-debuginfo.x86_64 0:9.6.15-1PGDG.rhel7              postgresql96-devel.x86_64 0:9.6.15-1PGDG.rhel7
  postgresql96-docs.x86_64 0:9.6.15-1PGDG.rhel7                   postgresql96-libs.x86_64 0:9.6.15-1PGDG.rhel7
  postgresql96-odbc.x86_64 0:11.01.0000-1PGDG.rhel7               postgresql96-plperl.x86_64 0:9.6.15-1PGDG.rhel7
  postgresql96-plpython.x86_64 0:9.6.15-1PGDG.rhel7               postgresql96-pltcl.x86_64 0:9.6.15-1PGDG.rhel7
  postgresql96-server.x86_64 0:9.6.15-1PGDG.rhel7                 postgresql96-tcl.x86_64 0:2.4.0-1.rhel7
  postgresql96-tcl-debuginfo.x86_64 0:2.3.1-1.rhel7               postgresql96-test.x86_64 0:9.6.15-1PGDG.rhel7

依存性関連をインストールしました:
  tcl.x86_64 1:8.5.13-8.el7                                    unixODBC.x86_64 0:2.3.1-11.el7
bannerAds