LoginSignup
0
0

More than 1 year has passed since last update.

cent os 7.6 に postgreSQL 10.16 をインストールして pgAdmin 4 から接続する

Last updated at Posted at 2021-05-04

postgreSQLの新規インストールからpgAdminでの接続までの記録になります。

image.png

DBサーバ
CentOS 7.6
postgreSQL 10.16
※Internet接続環境(インストール時のみ)
※selinux,firewalldは停止

管理サーバ
Windows Server 2019
pgAdmin 4 v5.2

1.postgreSQLのインストール

centOS7のデフォルトパッケージはpostgreSQL9.2系なので、postgreSQL公式サイトに従ってインストールを進めていきます。

default_yum_list
# yum list postgre*
利用可能なパッケージ
postgresql.i686                                                       9.2.24-4.el7_8                                           base
postgresql.x86_64                                                     9.2.24-4.el7_8                                           base
postgresql-contrib.x86_64                                             9.2.24-4.el7_8                                           base
postgresql-devel.i686                                                 9.2.24-4.el7_8                                           base
postgresql-devel.x86_64                                               9.2.24-4.el7_8                                           base
postgresql-docs.x86_64                                                9.2.24-4.el7_8                                           base
postgresql-jdbc.noarch                                                9.2.1002-8.el7_8                                         updates
postgresql-jdbc-javadoc.noarch                                        9.2.1002-8.el7_8                                         updates
postgresql-libs.i686                                                  9.2.24-4.el7_8                                           base
postgresql-libs.x86_64                                                9.2.24-4.el7_8                                           base
postgresql-odbc.x86_64                                                09.03.0100-2.el7                                         base
postgresql-plperl.x86_64                                              9.2.24-4.el7_8                                           base
postgresql-plpython.x86_64                                            9.2.24-4.el7_8                                           base
postgresql-pltcl.x86_64                                               9.2.24-4.el7_8                                           base
postgresql-server.x86_64                                              9.2.24-4.el7_8                                           base
postgresql-static.i686                                                9.2.24-4.el7_8                                           base
postgresql-static.x86_64                                              9.2.24-4.el7_8                                           base
postgresql-test.x86_64                                                9.2.24-4.el7_8                                           base
postgresql-upgrade.x86_64                                             9.2.24-4.el7_8                                           base

Downloadをクリックします。
image.png

OSおよびディストリビューションを選択します。
image.png

インストールしたいpostgreSQLのバージョンおよびOSバージョンとアーキテクチャを選択すると、セットアップ用のコマンドが表示されるのでこちらを控えます。
image.png

Linux側でpostgreSQLのリポジトリをインストールします。

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

これでインストール対象のpostgreSQL 10が表示されるようになりました。

update_yum_list(一部省略)
# yum list postgre*
利用可能なパッケージ
postgresql-server.x86_64                                                  9.2.24-4.el7_8                                                 base       
postgresql10-server.x86_64                                                10.16-1PGDG.rhel7                                              pgdg10     
postgresql11-server.x86_64                                                11.11-1PGDG.rhel7                                              pgdg11     
postgresql12-server.x86_64                                                12.6-1PGDG.rhel7                                               pgdg12     
postgresql13-server.x86_64                                                13.2-1PGDG.rhel7                                               pgdg13     
postgresql95-server.x86_64                                                9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql96-server.x86_64                                                9.6.21-1PGDG.rhel7                                             pgdg96     

yum list全文
update_yum_list
# yum list postgre*

利用可能なパッケージ
postcode_95.x86_64                                                        1.3.0-1.rhel7                                                  pgdg95     
postcode_96.x86_64                                                        1.3.0-1.rhel7                                                  pgdg96     
postfix.x86_64                                                            2:2.10.1-9.el7                                                 base       
postfix-perl-scripts.x86_64                                               2:2.10.1-9.el7                                                 base       
postfix-sysvinit.noarch                                                   2:2.10.1-9.el7                                                 base       
postgis22_95.x86_64                                                       2.2.7-1.rhel7                                                  pgdg95     
postgis22_95-client.x86_64                                                2.2.7-1.rhel7                                                  pgdg95     
postgis22_95-devel.x86_64                                                 2.2.7-1.rhel7                                                  pgdg95     
postgis22_95-docs.x86_64                                                  2.2.7-1.rhel7                                                  pgdg95     
postgis22_95-utils.x86_64                                                 2.2.7-1.rhel7                                                  pgdg95     
postgis22_96.x86_64                                                       2.2.7-1.rhel7                                                  pgdg96     
postgis22_96-client.x86_64                                                2.2.7-1.rhel7                                                  pgdg96     
postgis22_96-devel.x86_64                                                 2.2.7-1.rhel7                                                  pgdg96     
postgis22_96-docs.x86_64                                                  2.2.7-1.rhel7                                                  pgdg96     
postgis22_96-utils.x86_64                                                 2.2.7-1.rhel7                                                  pgdg96     
postgis23_10.x86_64                                                       2.3.7-1.rhel7                                                  pgdg10     
postgis23_10-client.x86_64                                                2.3.7-1.rhel7                                                  pgdg10     
postgis23_10-devel.x86_64                                                 2.3.7-1.rhel7                                                  pgdg10     
postgis23_10-docs.x86_64                                                  2.3.7-1.rhel7                                                  pgdg10     
postgis23_10-utils.x86_64                                                 2.3.7-1.rhel7                                                  pgdg10     
postgis23_95.x86_64                                                       2.3.7-1.rhel7                                                  pgdg95     
postgis23_95-client.x86_64                                                2.3.7-1.rhel7                                                  pgdg95     
postgis23_95-devel.x86_64                                                 2.3.7-1.rhel7                                                  pgdg95     
postgis23_95-docs.x86_64                                                  2.3.7-1.rhel7                                                  pgdg95     
postgis23_95-utils.x86_64                                                 2.3.7-1.rhel7                                                  pgdg95     
postgis23_96.x86_64                                                       2.3.7-1.rhel7                                                  pgdg96     
postgis23_96-client.x86_64                                                2.3.7-1.rhel7                                                  pgdg96     
postgis23_96-devel.x86_64                                                 2.3.7-1.rhel7                                                  pgdg96     
postgis23_96-docs.x86_64                                                  2.3.7-1.rhel7                                                  pgdg96     
postgis23_96-utils.x86_64                                                 2.3.7-1.rhel7                                                  pgdg96     
postgis24_10.x86_64                                                       2.4.9-3.rhel7                                                  pgdg10     
postgis24_10-client.x86_64                                                2.4.9-3.rhel7                                                  pgdg10     
postgis24_10-devel.x86_64                                                 2.4.9-3.rhel7                                                  pgdg10     
postgis24_10-docs.x86_64                                                  2.4.9-3.rhel7                                                  pgdg10     
postgis24_10-gui.x86_64                                                   2.4.9-3.rhel7                                                  pgdg10     
postgis24_10-utils.x86_64                                                 2.4.9-3.rhel7                                                  pgdg10     
postgis24_11.x86_64                                                       2.4.9-3.rhel7                                                  pgdg11     
postgis24_11-client.x86_64                                                2.4.9-3.rhel7                                                  pgdg11     
postgis24_11-devel.x86_64                                                 2.4.9-3.rhel7                                                  pgdg11     
postgis24_11-docs.x86_64                                                  2.4.9-3.rhel7                                                  pgdg11     
postgis24_11-gui.x86_64                                                   2.4.9-3.rhel7                                                  pgdg11     
postgis24_11-utils.x86_64                                                 2.4.9-3.rhel7                                                  pgdg11     
postgis24_95.x86_64                                                       2.4.9-3.rhel7                                                  pgdg95     
postgis24_95-client.x86_64                                                2.4.9-3.rhel7                                                  pgdg95     
postgis24_95-devel.x86_64                                                 2.4.9-3.rhel7                                                  pgdg95     
postgis24_95-docs.x86_64                                                  2.4.9-3.rhel7                                                  pgdg95     
postgis24_95-gui.x86_64                                                   2.4.9-3.rhel7                                                  pgdg95     
postgis24_95-utils.x86_64                                                 2.4.9-3.rhel7                                                  pgdg95     
postgis24_96.x86_64                                                       2.4.9-3.rhel7                                                  pgdg96     
postgis24_96-client.x86_64                                                2.4.9-3.rhel7                                                  pgdg96     
postgis24_96-devel.x86_64                                                 2.4.9-3.rhel7                                                  pgdg96     
postgis24_96-docs.x86_64                                                  2.4.9-3.rhel7                                                  pgdg96     
postgis24_96-gui.x86_64                                                   2.4.9-3.rhel7                                                  pgdg96     
postgis24_96-utils.x86_64                                                 2.4.9-3.rhel7                                                  pgdg96     
postgis25_10.x86_64                                                       2.5.5-4.rhel7                                                  pgdg10     
postgis25_10-client.x86_64                                                2.5.5-4.rhel7                                                  pgdg10     
postgis25_10-devel.x86_64                                                 2.5.5-4.rhel7                                                  pgdg10     
postgis25_10-docs.x86_64                                                  2.5.5-4.rhel7                                                  pgdg10     
postgis25_10-gui.x86_64                                                   2.5.5-4.rhel7                                                  pgdg10     
postgis25_10-utils.x86_64                                                 2.5.5-4.rhel7                                                  pgdg10     
postgis25_11.x86_64                                                       2.5.5-4.rhel7                                                  pgdg11     
postgis25_11-client.x86_64                                                2.5.5-4.rhel7                                                  pgdg11     
postgis25_11-devel.x86_64                                                 2.5.5-4.rhel7                                                  pgdg11     
postgis25_11-docs.x86_64                                                  2.5.5-4.rhel7                                                  pgdg11     
postgis25_11-gui.x86_64                                                   2.5.5-4.rhel7                                                  pgdg11     
postgis25_11-utils.x86_64                                                 2.5.5-4.rhel7                                                  pgdg11     
postgis25_12.x86_64                                                       2.5.5-4.rhel7                                                  pgdg12     
postgis25_12-client.x86_64                                                2.5.5-4.rhel7                                                  pgdg12     
postgis25_12-devel.x86_64                                                 2.5.5-4.rhel7                                                  pgdg12     
postgis25_12-docs.x86_64                                                  2.5.5-4.rhel7                                                  pgdg12     
postgis25_12-gui.x86_64                                                   2.5.5-4.rhel7                                                  pgdg12     
postgis25_12-utils.x86_64                                                 2.5.5-4.rhel7                                                  pgdg12     
postgis25_95.x86_64                                                       2.5.5-2.rhel7                                                  pgdg95     
postgis25_95-client.x86_64                                                2.5.5-2.rhel7                                                  pgdg95     
postgis25_95-devel.x86_64                                                 2.5.5-2.rhel7                                                  pgdg95     
postgis25_95-docs.x86_64                                                  2.5.5-2.rhel7                                                  pgdg95     
postgis25_95-gui.x86_64                                                   2.5.5-2.rhel7                                                  pgdg95     
postgis25_95-utils.x86_64                                                 2.5.5-2.rhel7                                                  pgdg95     
postgis25_96.x86_64                                                       2.5.5-4.rhel7                                                  pgdg96     
postgis25_96-client.x86_64                                                2.5.5-4.rhel7                                                  pgdg96     
postgis25_96-devel.x86_64                                                 2.5.5-4.rhel7                                                  pgdg96     
postgis25_96-docs.x86_64                                                  2.5.5-4.rhel7                                                  pgdg96     
postgis25_96-gui.x86_64                                                   2.5.5-4.rhel7                                                  pgdg96     
postgis25_96-utils.x86_64                                                 2.5.5-4.rhel7                                                  pgdg96     
postgis2_95.x86_64                                                        2.2.5-1.rhel7                                                  pgdg95     
postgis2_95-client.x86_64                                                 2.2.5-1.rhel7                                                  pgdg95     
postgis2_95-devel.x86_64                                                  2.2.5-1.rhel7                                                  pgdg95     
postgis2_95-docs.x86_64                                                   2.2.5-1.rhel7                                                  pgdg95     
postgis2_95-utils.x86_64                                                  2.2.5-1.rhel7                                                  pgdg95     
postgis2_96.x86_64                                                        2.3.2-1.rhel7                                                  pgdg96     
postgis2_96-client.x86_64                                                 2.3.2-1.rhel7                                                  pgdg96     
postgis2_96-devel.x86_64                                                  2.3.2-1.rhel7                                                  pgdg96     
postgis2_96-docs.x86_64                                                   2.3.2-1.rhel7                                                  pgdg96     
postgis2_96-utils.x86_64                                                  2.3.2-1.rhel7                                                  pgdg96     
postgis30_10.x86_64                                                       3.0.3-7.rhel7                                                  pgdg10     
postgis30_10-client.x86_64                                                3.0.3-7.rhel7                                                  pgdg10     
postgis30_10-devel.x86_64                                                 3.0.3-7.rhel7                                                  pgdg10     
postgis30_10-docs.x86_64                                                  3.0.3-7.rhel7                                                  pgdg10     
postgis30_10-gui.x86_64                                                   3.0.3-7.rhel7                                                  pgdg10     
postgis30_10-utils.x86_64                                                 3.0.3-7.rhel7                                                  pgdg10     
postgis30_11.x86_64                                                       3.0.3-7.rhel7                                                  pgdg11     
postgis30_11-client.x86_64                                                3.0.3-7.rhel7                                                  pgdg11     
postgis30_11-devel.x86_64                                                 3.0.3-7.rhel7                                                  pgdg11     
postgis30_11-docs.x86_64                                                  3.0.3-7.rhel7                                                  pgdg11     
postgis30_11-gui.x86_64                                                   3.0.3-7.rhel7                                                  pgdg11     
postgis30_11-utils.x86_64                                                 3.0.3-7.rhel7                                                  pgdg11     
postgis30_12.x86_64                                                       3.0.3-7.rhel7                                                  pgdg12     
postgis30_12-client.x86_64                                                3.0.3-7.rhel7                                                  pgdg12     
postgis30_12-devel.x86_64                                                 3.0.3-7.rhel7                                                  pgdg12     
postgis30_12-docs.x86_64                                                  3.0.3-7.rhel7                                                  pgdg12     
postgis30_12-gui.x86_64                                                   3.0.3-7.rhel7                                                  pgdg12     
postgis30_12-utils.x86_64                                                 3.0.3-7.rhel7                                                  pgdg12     
postgis30_13.x86_64                                                       3.0.3-7.rhel7                                                  pgdg13     
postgis30_13-client.x86_64                                                3.0.3-7.rhel7                                                  pgdg13     
postgis30_13-devel.x86_64                                                 3.0.3-7.rhel7                                                  pgdg13     
postgis30_13-docs.x86_64                                                  3.0.3-7.rhel7                                                  pgdg13     
postgis30_13-gui.x86_64                                                   3.0.3-7.rhel7                                                  pgdg13     
postgis30_13-utils.x86_64                                                 3.0.3-7.rhel7                                                  pgdg13     
postgis30_95.x86_64                                                       3.0.3-3.rhel7                                                  pgdg95     
postgis30_95-client.x86_64                                                3.0.3-3.rhel7                                                  pgdg95     
postgis30_95-devel.x86_64                                                 3.0.3-3.rhel7                                                  pgdg95     
postgis30_95-docs.x86_64                                                  3.0.3-3.rhel7                                                  pgdg95     
postgis30_95-gui.x86_64                                                   3.0.3-3.rhel7                                                  pgdg95     
postgis30_95-utils.x86_64                                                 3.0.3-3.rhel7                                                  pgdg95     
postgis30_96.x86_64                                                       3.0.3-7.rhel7                                                  pgdg96     
postgis30_96-client.x86_64                                                3.0.3-7.rhel7                                                  pgdg96     
postgis30_96-devel.x86_64                                                 3.0.3-7.rhel7                                                  pgdg96     
postgis30_96-docs.x86_64                                                  3.0.3-7.rhel7                                                  pgdg96     
postgis30_96-gui.x86_64                                                   3.0.3-7.rhel7                                                  pgdg96     
postgis30_96-utils.x86_64                                                 3.0.3-7.rhel7                                                  pgdg96     
postgis31_11.x86_64                                                       3.1.1-3.rhel7                                                  pgdg11     
postgis31_11-client.x86_64                                                3.1.1-3.rhel7                                                  pgdg11     
postgis31_11-devel.x86_64                                                 3.1.1-3.rhel7                                                  pgdg11     
postgis31_11-docs.x86_64                                                  3.1.1-3.rhel7                                                  pgdg11     
postgis31_11-gui.x86_64                                                   3.1.1-3.rhel7                                                  pgdg11     
postgis31_11-utils.x86_64                                                 3.1.1-3.rhel7                                                  pgdg11     
postgis31_12.x86_64                                                       3.1.1-3.rhel7                                                  pgdg12     
postgis31_12-client.x86_64                                                3.1.1-3.rhel7                                                  pgdg12     
postgis31_12-devel.x86_64                                                 3.1.1-3.rhel7                                                  pgdg12     
postgis31_12-docs.x86_64                                                  3.1.1-3.rhel7                                                  pgdg12     
postgis31_12-gui.x86_64                                                   3.1.1-3.rhel7                                                  pgdg12     
postgis31_12-utils.x86_64                                                 3.1.1-3.rhel7                                                  pgdg12     
postgis31_13.x86_64                                                       3.1.1-3.rhel7                                                  pgdg13     
postgis31_13-client.x86_64                                                3.1.1-3.rhel7                                                  pgdg13     
postgis31_13-devel.x86_64                                                 3.1.1-3.rhel7                                                  pgdg13     
postgis31_13-docs.x86_64                                                  3.1.1-3.rhel7                                                  pgdg13     
postgis31_13-gui.x86_64                                                   3.1.1-3.rhel7                                                  pgdg13     
postgis31_13-utils.x86_64                                                 3.1.1-3.rhel7                                                  pgdg13     
postgresql.i686                                                           9.2.24-4.el7_8                                                 base       
postgresql.x86_64                                                         9.2.24-4.el7_8                                                 base       
postgresql-contrib.x86_64                                                 9.2.24-4.el7_8                                                 base       
postgresql-devel.i686                                                     9.2.24-4.el7_8                                                 base       
postgresql-devel.x86_64                                                   9.2.24-4.el7_8                                                 base       
postgresql-docs.x86_64                                                    9.2.24-4.el7_8                                                 base       
postgresql-jdbc.noarch                                                    42.2.20-1.rhel7                                                pgdg-common
postgresql-jdbc-javadoc.noarch                                            42.2.20-1.rhel7                                                pgdg-common
postgresql-libs.i686                                                      9.2.24-4.el7_8                                                 base       
postgresql-libs.x86_64                                                    9.2.24-4.el7_8                                                 base       
postgresql-odbc.x86_64                                                    09.03.0100-2.el7                                               base       
postgresql-plperl.x86_64                                                  9.2.24-4.el7_8                                                 base       
postgresql-plpython.x86_64                                                9.2.24-4.el7_8                                                 base       
postgresql-pltcl.x86_64                                                   9.2.24-4.el7_8                                                 base       
postgresql-server.x86_64                                                  9.2.24-4.el7_8                                                 base       
postgresql-static.i686                                                    9.2.24-4.el7_8                                                 base       
postgresql-static.x86_64                                                  9.2.24-4.el7_8                                                 base       
postgresql-test.x86_64                                                    9.2.24-4.el7_8                                                 base       
postgresql-unit10.x86_64                                                  7.2-1.rhel7                                                    pgdg10     
postgresql-unit11.x86_64                                                  7.2-1.rhel7                                                    pgdg11     
postgresql-unit12.x86_64                                                  7.2-1.rhel7.1                                                  pgdg12     
postgresql-unit13.x86_64                                                  7.2-1.rhel7.1                                                  pgdg13     
postgresql-unit95.x86_64                                                  7.2-1.rhel7                                                    pgdg95     
postgresql-unit96.x86_64                                                  7.2-1.rhel7                                                    pgdg96     
postgresql-upgrade.x86_64                                                 9.2.24-4.el7_8                                                 base       
postgresql10.x86_64                                                       10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-contrib.x86_64                                               10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-devel.x86_64                                                 10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-docs.x86_64                                                  10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-libs.x86_64                                                  10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-odbc.x86_64                                                  13.00.0000-1PGDG.rhel7                                         pgdg10     
postgresql10-plperl.x86_64                                                10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-plpython.x86_64                                              10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-plpython3.x86_64                                             10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-pltcl.x86_64                                                 10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-server.x86_64                                                10.16-1PGDG.rhel7                                              pgdg10     
postgresql10-tcl.x86_64                                                   2.7.5-1.rhel7                                                  pgdg10     
postgresql10-test.x86_64                                                  10.16-1PGDG.rhel7                                              pgdg10     
postgresql11.x86_64                                                       11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-contrib.x86_64                                               11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-devel.x86_64                                                 11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-docs.x86_64                                                  11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-libs.x86_64                                                  11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-llvmjit.x86_64                                               11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-odbc.x86_64                                                  13.00.0000-1PGDG.rhel7                                         pgdg11     
postgresql11-plperl.x86_64                                                11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-plpython.x86_64                                              11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-plpython3.x86_64                                             11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-pltcl.x86_64                                                 11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-server.x86_64                                                11.11-1PGDG.rhel7                                              pgdg11     
postgresql11-tcl.x86_64                                                   2.7.5-1.rhel7                                                  pgdg11     
postgresql11-test.x86_64                                                  11.11-1PGDG.rhel7                                              pgdg11     
postgresql12.x86_64                                                       12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-contrib.x86_64                                               12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-devel.x86_64                                                 12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-docs.x86_64                                                  12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-libs.x86_64                                                  12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-llvmjit.x86_64                                               12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-odbc.x86_64                                                  13.00.0000-1PGDG.rhel7                                         pgdg12     
postgresql12-odbc-debuginfo.x86_64                                        12.02.0000-1PGDG.rhel7                                         pgdg-common
postgresql12-plperl.x86_64                                                12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-plpython.x86_64                                              12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-plpython3.x86_64                                             12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-pltcl.x86_64                                                 12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-server.x86_64                                                12.6-1PGDG.rhel7                                               pgdg12     
postgresql12-tcl.x86_64                                                   2.7.5-1.rhel7                                                  pgdg12     
postgresql12-test.x86_64                                                  12.6-1PGDG.rhel7                                               pgdg12     
postgresql13.x86_64                                                       13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-contrib.x86_64                                               13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-devel.x86_64                                                 13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-docs.x86_64                                                  13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-libs.x86_64                                                  13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-llvmjit.x86_64                                               13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-odbc.x86_64                                                  13.00.0000-1PGDG.rhel7                                         pgdg13     
postgresql13-plperl.x86_64                                                13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-plpython3.x86_64                                             13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-pltcl.x86_64                                                 13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-server.x86_64                                                13.2-1PGDG.rhel7                                               pgdg13     
postgresql13-test.x86_64                                                  13.2-1PGDG.rhel7                                               pgdg13     
postgresql95.x86_64                                                       9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-contrib.x86_64                                               9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-devel.x86_64                                                 9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-docs.x86_64                                                  9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-libs.x86_64                                                  9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-odbc.x86_64                                                  13.00.0000-1PGDG.rhel7                                         pgdg95     
postgresql95-plperl.x86_64                                                9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-plpython.x86_64                                              9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-plpython3.x86_64                                             9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-pltcl.x86_64                                                 9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-server.x86_64                                                9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql95-tcl.x86_64                                                   2.7.5-1.rhel7                                                  pgdg95     
postgresql95-test.x86_64                                                  9.5.25-1PGDG.rhel7                                             pgdg95     
postgresql96.x86_64                                                       9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-contrib.x86_64                                               9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-devel.x86_64                                                 9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-docs.x86_64                                                  9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-libs.x86_64                                                  9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-odbc.x86_64                                                  13.00.0000-1PGDG.rhel7                                         pgdg96     
postgresql96-plperl.x86_64                                                9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-plpython.x86_64                                              9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-plpython3.x86_64                                             9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-pltcl.x86_64                                                 9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-server.x86_64                                                9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql96-tcl.x86_64                                                   2.7.5-1.rhel7                                                  pgdg96     
postgresql96-test.x86_64                                                  9.6.21-1PGDG.rhel7                                             pgdg96     
postgresql_anonymizer10.noarch                                            0.3.1-1.rhel7                                                  pgdg10     
postgresql_anonymizer10.x86_64                                            0.7.1-1.rhel7                                                  pgdg10     
postgresql_anonymizer11.noarch                                            0.3.1-1.rhel7                                                  pgdg11     
postgresql_anonymizer11.x86_64                                            0.7.1-1.rhel7                                                  pgdg11     
postgresql_anonymizer12.noarch                                            0.3.1-1.rhel7.1                                                pgdg12     
postgresql_anonymizer12.x86_64                                            0.7.1-1.rhel7                                                  pgdg12     
postgresql_anonymizer13.x86_64                                            0.7.1-1.rhel7                                                  pgdg13     
postgresql_anonymizer95.noarch                                            0.3.1-1.rhel7                                                  pgdg95     
postgresql_anonymizer95.x86_64                                            0.7.1-1.rhel7                                                  pgdg95     
postgresql_anonymizer96.noarch                                            0.3.1-1.rhel7                                                  pgdg96     
postgresql_anonymizer96.x86_64                                            0.7.1-1.rhel7                                                  pgdg96     
postgresql_anonymizer_10.x86_64                                           0.8.1-1.rhel7                                                  pgdg10     
postgresql_anonymizer_11.x86_64                                           0.8.1-1.rhel7                                                  pgdg11     
postgresql_anonymizer_12.x86_64                                           0.8.1-1.rhel7                                                  pgdg12     
postgresql_anonymizer_13.x86_64                                           0.8.1-1.rhel7                                                  pgdg13     
postgresql_anonymizer_95.x86_64                                           0.8.1-1.rhel7                                                  pgdg95     
postgresql_anonymizer_96.x86_64                                           0.8.1-1.rhel7                                                  pgdg96     
postgresql_autodoc.noarch                                                 1.41.1-1.rhel7.1                                               pgdg-common
postgresql_faker_10.noarch                                                0.3.0-1.rhel7                                                  pgdg10     
postgresql_faker_11.noarch                                                0.3.0-1.rhel7                                                  pgdg11     
postgresql_faker_12.noarch                                                0.3.0-1.rhel7                                                  pgdg12     
postgresql_faker_13.noarch                                                0.3.0-1.rhel7                                                  pgdg13     
postgresql_faker_96.noarch                                                0.3.0-1.rhel7                                             pgdg96     

今回利用したいpostgreSQL10をインストールします。

yum_install
[root@cent76-d1 ~]# yum list postgresql10*
利用可能なパッケージ
postgresql10.x86_64                                                       10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-contrib.x86_64                                               10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-devel.x86_64                                                 10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-docs.x86_64                                                  10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-libs.x86_64                                                  10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-odbc.x86_64                                                  13.00.0000-1PGDG.rhel7                                              pgdg10
postgresql10-plperl.x86_64                                                10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-plpython.x86_64                                              10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-plpython3.x86_64                                             10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-pltcl.x86_64                                                 10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-server.x86_64                                                10.16-1PGDG.rhel7                                                   pgdg10
postgresql10-tcl.x86_64                                                   2.7.5-1.rhel7                                                       pgdg10
postgresql10-test.x86_64                                                  10.16-1PGDG.rhel7                                                   pgdg10
[root@cent76-d1 ~]# 


[root@cent76-d1 ~]# yum install postgresql10*
<<<中略>>>
====================================================================================================================================================
 Package                                    アーキテクチャー           バージョン                                 リポジトリー                 容量
====================================================================================================================================================
インストール中:
 postgresql10                               x86_64                     10.16-1PGDG.rhel7                          pgdg10                      1.6 M
 postgresql10-contrib                       x86_64                     10.16-1PGDG.rhel7                          pgdg10                      589 k
 postgresql10-devel                         x86_64                     10.16-1PGDG.rhel7                          pgdg10                      2.0 M
 postgresql10-docs                          x86_64                     10.16-1PGDG.rhel7                          pgdg10                       11 M
 postgresql10-libs                          x86_64                     10.16-1PGDG.rhel7                          pgdg10                      358 k
 postgresql10-odbc                          x86_64                     13.00.0000-1PGDG.rhel7                     pgdg10                      302 k
 postgresql10-plperl                        x86_64                     10.16-1PGDG.rhel7                          pgdg10                       61 k
 postgresql10-plpython                      x86_64                     10.16-1PGDG.rhel7                          pgdg10                       90 k
 postgresql10-plpython3                     x86_64                     10.16-1PGDG.rhel7                          pgdg10                       89 k
 postgresql10-pltcl                         x86_64                     10.16-1PGDG.rhel7                          pgdg10                       40 k
 postgresql10-server                        x86_64                     10.16-1PGDG.rhel7                          pgdg10                      4.5 M
 postgresql10-tcl                           x86_64                     2.7.5-1.rhel7                              pgdg10                      349 k
 postgresql10-test                          x86_64                     10.16-1PGDG.rhel7                          pgdg10                      1.6 M
依存性関連でのインストールをします:
 libicu-devel                               x86_64                     50.2-4.el7_7                               base                        703 k
 libtirpc                                   x86_64                     0.2.4-0.16.el7                             base                         89 k
 perl                                       x86_64                     4:5.16.3-299.el7_9                         updates                     8.0 M
 perl-Carp                                  noarch                     1.26-244.el7                               base                         19 k
 perl-Encode                                x86_64                     2.51-7.el7                                 base                        1.5 M
 perl-Exporter                              noarch                     5.68-3.el7                                 base                         28 k
 perl-File-Path                             noarch                     2.09-2.el7                                 base                         26 k
 perl-File-Temp                             noarch                     0.23.01-3.el7                              base                         56 k
 perl-Filter                                x86_64                     1.49-3.el7                                 base                         76 k
 perl-Getopt-Long                           noarch                     2.40-3.el7                                 base                         56 k
 perl-HTTP-Tiny                             noarch                     0.033-3.el7                                base                         38 k
 perl-PathTools                             x86_64                     3.40-5.el7                                 base                         82 k
 perl-Pod-Escapes                           noarch                     1:1.04-299.el7_9                           updates                      52 k
 perl-Pod-Perldoc                           noarch                     3.20-4.el7                                 base                         87 k
 perl-Pod-Simple                            noarch                     1:3.28-4.el7                               base                        216 k
 perl-Pod-Usage                             noarch                     1.63-3.el7                                 base                         27 k
 perl-Scalar-List-Utils                     x86_64                     1.27-248.el7                               base                         36 k
 perl-Socket                                x86_64                     2.010-5.el7                                base                         49 k
 perl-Storable                              x86_64                     2.45-3.el7                                 base                         77 k
 perl-Text-ParseWords                       noarch                     3.29-4.el7                                 base                         14 k
 perl-Time-HiRes                            x86_64                     4:1.9725-3.el7                             base                         45 k
 perl-Time-Local                            noarch                     1.2300-2.el7                               base                         24 k
 perl-constant                              noarch                     1.27-2.el7                                 base                         19 k
 perl-libs                                  x86_64                     4:5.16.3-299.el7_9                         updates                     690 k
 perl-macros                                x86_64                     4:5.16.3-299.el7_9                         updates                      44 k
 perl-parent                                noarch                     1:0.225-244.el7                            base                         12 k
 perl-podlators                             noarch                     2.5.1-3.el7                                base                        112 k
 perl-threads                               x86_64                     1.87-4.el7                                 base                         49 k
 perl-threads-shared                        x86_64                     1.43-6.el7                                 base                         39 k
 python3                                    x86_64                     3.6.8-18.el7                               updates                      70 k
 python3-libs                               x86_64                     3.6.8-18.el7                               updates                     6.9 M
 python3-pip                                noarch                     9.0.3-8.el7                                base                        1.6 M
 python3-setuptools                         noarch                     39.2.0-10.el7                              base                        629 k
 tcl                                        x86_64                     1:8.5.13-8.el7                             base                        1.9 M
 unixODBC                                   x86_64                     2.3.1-14.el7                               base                        413 k
依存性関連での更新をします:
 libicu                                     x86_64                     50.2-4.el7_7                               base                        6.9 M
<<<中略>>>
完了しました!

2.postgreSQLの自動起動と実行

プロセスの自動起動を有効化します。

process_enable
[root@cent76-d1 ~]# systemctl enable postgresql-10

[root@cent76-d1 ~]# systemctl is-enabled postgresql-10
enabled
[root@cent76-d1 ~]# 

プロセスの起動をしますが、エラーが表示されます。

process_start_error
[root@cent76-d1 ~]# systemctl start postgresql-10
Job for postgresql-10.service failed because the control process exited with error code. See "systemctl status postgresql-10.service" and "journalctl -xe" for details.
[root@cent76-d1 ~]# 

エラーの原因はinitdb処理がされていないためなので、initdbを実行します。

initdb
[root@cent76-d1 ~]# /usr/pgsql-10/bin/postgresql-10-setup initdb
Initializing database ... OK

[root@cent76-d1 ~]# 

これでプロセスが正常に起動します。

process_start
[root@cent76-d1 ~]# systemctl start postgresql-10
[root@cent76-d1 ~]# 

3.ローカル接続確認

まずはローカルで接続確認を行います。

local_login
[root@cent76-d1 ~]# sudo -u postgres psql -U postgres
could not change directory to "/root": 許可がありません
psql (10.16)
Type "help" for help.

postgres=# 
postgres=# \q
[root@cent76-d1 ~]# 

4.リモート接続設定(postgresql.conf)

リモート接続を受け付ける自セグメントを定義するため、以下コンフィグファイルに追記をします。最上1行が追記部分です。

ファイル:/var/lib/pgsql/10/data/postgresql.conf

pg_hba.conf
listen_addresses = '*'                  ### CUSTOM ADD ###
#listen_addresses = 'localhost'         # what IP address(es) to listen on;

5.リモート接続設定(pg_hba.conf)

リモート接続してくるセグメントについての接続許可設定をするため、以下コンフィグファイルに追記をします。最下2行が追記部分です。

ファイル:/var/lib/pgsql/10/data/pg_hba.conf

pg_hba.conf
# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            ident
host    replication     all             ::1/128                 ident

### CUSTOM ADD ###
host    all             postgres        10.0.1.0/24             trust
項目 内容 説明
TYPE host 認証対象。'host'は任意の対象。
DATABASE all 対象DB。'all'は全てのDBを対象。
USER postgres 対象ユーザ。'postgres'でスーパーユーザのみの指定
ADDRESS 10.0.1.0/24 接続元。指定のセグメントをCIDR表記で記載。
METHOD trust 認証方式。trustは認証無しでログイン可能。

※認証METHODをtrustとした場合、ユーザ名のみで接続可能なため、適切な構築タイミングでmd5認証やpeer認証に変更することを推奨します。

5.pgAdminから接続

管理サーバ(Windows)にてpgAdminを起動します。
image.png

オブジェクト - 作成 - サーバ を選択します。
image.png

一般タブ、接続タブにて各種設定を記載します。
なお、接続タブのパスワードについてはtrust認証のため無入力としています。
image.png
image.png

接続ができました。
image.png

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0