오픈소스의 일상

#2. Postgresql 11.x 설치 (21.12.22. 기준) 본문

오픈소스/네이버클라우드

#2. Postgresql 11.x 설치 (21.12.22. 기준)

실버카미 2021. 12. 21. 15:54

1. Centos 업데이트

[root@flas ~]# yum update -y
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
base                                                   | 3.6 kB     00:00
extras                                                 | 2.9 kB     00:00
updates                                                | 2.9 kB     00:00
(1/4): base/7/x86_64/group_gz                            | 153 kB   00:00
(2/4): extras/7/x86_64/primary_db                        | 243 kB   00:00
(3/4): base/7/x86_64/primary_db                          | 6.1 MB   00:00
(4/4): updates/7/x86_64/primary_db                       |  13 MB   00:00
Resolving Dependencies
--> Running transaction check
--> 이하 생략
Complete!
[root@flas ~]# reboot

서버를 재시작을 권장 또는 reboot. (2021.12.22 최종확인)

2. CentOS 7에 PostgreSQL 저장소 추가

[root@flas ~]# sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Loaded plugins: fastestmirror, langpacks
pgdg-redhat-repo-latest.noarch.rpm                     | 8.1 kB     00:00
Examining /var/tmp/yum-root-FstIxf/pgdg-redhat-repo-latest.noarch.rpm: pgdg-redhat-repo-42.0-23.noarch
Marking /var/tmp/yum-root-FstIxf/pgdg-redhat-repo-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-23 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================
 Package           Arch    Version     Repository                        Size
==============================================================================
Installing:
 pgdg-redhat-repo  noarch  42.0-23     /pgdg-redhat-repo-latest.noarch   12 k

Transaction Summary
==============================================================================
Install  1 Package

Total size: 12 k
Installed size: 12 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pgdg-redhat-repo-42.0-23.noarch                            1/1
  Verifying  : pgdg-redhat-repo-42.0-23.noarch                            1/1

Installed:
  pgdg-redhat-repo.noarch 0:42.0-23

Complete!

 

3. PostgreSQL 11.X 서버 및 클라이언트 설치

[root@flas ~]# yum install postgresql11-server postgresql11 -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
pgdg-common/7/x86_64/signature                         |  198 B     00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
 Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
 Package    : pgdg-redhat-repo-42.0-23.noarch (@/pgdg-redhat-repo-latest.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg-common/7/x86_64/signature                         | 2.9 kB     00:00 !!!
pgdg10/7/x86_64/signature                              |  198 B     00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
 Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
 Package    : pgdg-redhat-repo-42.0-23.noarch (@/pgdg-redhat-repo-latest.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg10/7/x86_64/signature                              | 3.6 kB     00:00 !!!
pgdg11/7/x86_64/signature                              |  198 B     00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
 Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
 Package    : pgdg-redhat-repo-42.0-23.noarch (@/pgdg-redhat-repo-latest.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg11/7/x86_64/signature                              | 3.6 kB     00:00 !!!
pgdg12/7/x86_64/signature                              |  198 B     00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
 Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
 Package    : pgdg-redhat-repo-42.0-23.noarch (@/pgdg-redhat-repo-latest.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg12/7/x86_64/signature                              | 3.6 kB     00:00 !!!
pgdg13/7/x86_64/signature                              |  198 B     00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
 Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
 Package    : pgdg-redhat-repo-42.0-23.noarch (@/pgdg-redhat-repo-latest.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg13/7/x86_64/signature                              | 3.6 kB     00:00 !!!
pgdg14/7/x86_64/signature                              |  198 B     00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
 Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
 Package    : pgdg-redhat-repo-42.0-23.noarch (@/pgdg-redhat-repo-latest.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg14/7/x86_64/signature                              | 3.6 kB     00:00 !!!
pgdg96/7/x86_64/signature                              |  198 B     00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
 Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
 Package    : pgdg-redhat-repo-42.0-23.noarch (@/pgdg-redhat-repo-latest.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
pgdg96/7/x86_64/signature                              | 3.6 kB     00:00 !!!
(1/13): pgdg10/7/x86_64/group_gz                         |  245 B   00:01
(2/13): pgdg11/7/x86_64/group_gz                         |  245 B   00:01
(3/13): pgdg12/7/x86_64/group_gz                         |  245 B   00:00
(4/13): pgdg13/7/x86_64/group_gz                         |  246 B   00:00
(5/13): pgdg11/7/x86_64/primary_db                       | 381 kB   00:01
(6/13): pgdg14/7/x86_64/group_gz                         |  244 B   00:00
(7/13): pgdg12/7/x86_64/primary_db                       | 244 kB   00:00
(8/13): pgdg14/7/x86_64/primary_db                       |  70 kB   00:00
(9/13): pgdg10/7/x86_64/primary_db                       | 356 kB   00:02
(10/13): pgdg13/7/x86_64/primary_db                      | 154 kB   00:00
(11/13): pgdg-common/7/x86_64/primary_db                 | 152 kB   00:02
(12/13): pgdg96/7/x86_64/group_gz                        |  249 B   00:00
(13/13): pgdg96/7/x86_64/primary_db                      | 342 kB   00:00
Resolving Dependencies
--> Running transaction check
---> Package postgresql11.x86_64 0:11.14-1PGDG.rhel7 will be installed
--> Processing Dependency: postgresql11-libs(x86-64) = 11.14-1PGDG.rhel7 for package: postgresql11-11.14-1PGDG.rhel7.x86_64
--> Processing Dependency: libicu for package: postgresql11-11.14-1PGDG.rhel7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package: postgresql11-11.14-1PGDG.rhel7.x86_64
---> Package postgresql11-server.x86_64 0:11.14-1PGDG.rhel7 will be installed
--> Running transaction check
---> Package libicu.x86_64 0:50.2-4.el7_7 will be installed
---> Package postgresql11-libs.x86_64 0:11.14-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================
 Package                 Arch       Version                  Repository  Size
==============================================================================
Installing:
 postgresql11            x86_64     11.14-1PGDG.rhel7        pgdg11     1.7 M
 postgresql11-server     x86_64     11.14-1PGDG.rhel7        pgdg11     4.7 M
Installing for dependencies:
 libicu                  x86_64     50.2-4.el7_7             base       6.9 M
 postgresql11-libs       x86_64     11.14-1PGDG.rhel7        pgdg11     365 k

Transaction Summary
==============================================================================
Install  2 Packages (+2 Dependent packages)

Total download size: 14 M
Installed size: 53 M
Downloading packages:
(1/4): libicu-50.2-4.el7_7.x86_64.rpm                    | 6.9 MB   00:00
warning: /var/cache/yum/x86_64/7/pgdg11/packages/postgresql11-11.14-1PGDG.rhel7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEY
Public key for postgresql11-11.14-1PGDG.rhel7.x86_64.rpm is not installed
(2/4): postgresql11-11.14-1PGDG.rhel7.x86_64.rpm         | 1.7 MB   00:02
(3/4): postgresql11-libs-11.14-1PGDG.rhel7.x86_64.rpm    | 365 kB   00:02
(4/4): postgresql11-server-11.14-1PGDG.rhel7.x86_64.rpm  | 4.7 MB   00:00
------------------------------------------------------------------------------
Total                                            5.0 MB/s |  14 MB  00:02
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Importing GPG key 0x442DF0F8:
 Userid     : "PostgreSQL RPM Building Project <pgsql-pkg-yum@postgresql.org>"
 Fingerprint: 68c9 e2b9 1a37 d136 fe74 d176 1f16 d2e1 442d f0f8
 Package    : pgdg-redhat-repo-42.0-23.noarch (@/pgdg-redhat-repo-latest.noarch)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libicu-50.2-4.el7_7.x86_64                                 1/4
  Installing : postgresql11-libs-11.14-1PGDG.rhel7.x86_64                 2/4
  Installing : postgresql11-11.14-1PGDG.rhel7.x86_64                      3/4
  Installing : postgresql11-server-11.14-1PGDG.rhel7.x86_64               4/4
  Verifying  : postgresql11-11.14-1PGDG.rhel7.x86_64                      1/4
  Verifying  : postgresql11-server-11.14-1PGDG.rhel7.x86_64               2/4
  Verifying  : postgresql11-libs-11.14-1PGDG.rhel7.x86_64                 3/4
  Verifying  : libicu-50.2-4.el7_7.x86_64                                 4/4

Installed:
  postgresql11.x86_64 0:11.14-1PGDG.rhel7
  postgresql11-server.x86_64 0:11.14-1PGDG.rhel7

Dependency Installed:
  libicu.x86_64 0:50.2-4.el7_7  postgresql11-libs.x86_64 0:11.14-1PGDG.rhel7

Complete!

4. PostgreSQL 초기화, 서비스활성 및 시작

[root@flas ~]# /usr/pgsql-11/bin/postgresql-11-setup initdb
Initializing database ... OK

[root@flas ~]# systemctl enable postgresql-11.service
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-11.service to /usr/lib/systemd/system/postgresql-11.service.

[root@flas ~]# systemctl start postgresql-11.service

 

5. 설치확인 및 디비접속 체크

[root@flas ~]# ps -ef|grep post
postgres 12674     1  0 16:09 ?        00:00:00 /usr/pgsql-11/bin/postmaster -D /var/lib/pgsql/11/data/
postgres 12676 12674  0 16:09 ?        00:00:00 postgres: logger
postgres 12678 12674  0 16:09 ?        00:00:00 postgres: checkpointer
postgres 12679 12674  0 16:09 ?        00:00:00 postgres: background writer
postgres 12680 12674  0 16:09 ?        00:00:00 postgres: walwriter
postgres 12681 12674  0 16:09 ?        00:00:00 postgres: autovacuum launcher 
postgres 12682 12674  0 16:09 ?        00:00:00 postgres: stats collector
postgres 12683 12674  0 16:09 ?        00:00:00 postgres: logical replication launcher
root     16689  7717  0 16:19 pts/0    00:00:00 grep --color=auto post

[root@flas ~]# su - postgres
-bash-4.2$

 

 


https://www.symmcom.com/docs/how-tos/databases/how-to-install-postgresql-11-x-on-centos-7

 

How To Install PostgreSQL 11.x on CentOS 7 - SymmCom

How To Install PostgreSQL 11.x on CentOS 7 SymmCom Parent Category: HOW-TOs Databases 15 April 2019 Hits: 46261 Based on Postgres 4.2, PostgreSQL was developed at Berkeley Computer Science Development, University of California. It was created to be a power

www.symmcom.com

2021.12.21 - [오픈소스/네이버클라우드] - #1. NCloud에 Centos7.8 64bit 서버생성

 

#1. NCloud에 Centos7.8 64bit 서버생성

 

ecomet.tistory.com

 

728x90

'오픈소스 > 네이버클라우드' 카테고리의 다른 글

#6. OpenJDK 1.8 설정  (0) 2021.12.22
#5. PostgreSQL 설정  (0) 2021.12.22
#4. PostGIS 3.1.X 설치 및 확인  (0) 2021.12.21
#3. 필수 라이브러리 설치  (0) 2021.12.21
#1. NCloud에 Centos7.8 64bit 서버생성  (0) 2021.12.21