CentOS 8에 PostgreSQL 10 설치 (AppStream)

CentOS 8에 PostgreSQL 10 설치 (AppStream)

2022-10-05 last update

6 minutes reading centos8 PostgreSQL appstream

소개



Application Stream (AppStream)을 사용하여 CentOS8에 PostgreSQL 10 설치
상위 기사 : 그 중 작성 예정
참고 : RHEL8 패키지 구성 - BaseOS 및 Application Stream - 적모 엔지니어 블로그

지원



본 수법으로 도입한 경우, Red Hat Enterprise Linux 8 Application Streams Life Cycle - Red Hat Customer Portal 보다, 2024-05가 EOL이라고 생각된다.
그 이후에 보고된 취약성이나 결함에 대한 대응은 실시되지 않을 가능성이 있다.

LOG



설치


# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)

# yum install -y @postgresql:10
... 略

# /usr/bin/postgresql-setup --initdb
... 略

postgresql 시작/중지


# systemctl start postgresql
# systemctl status postgresql
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-09-26 09:42:01 EDT; 1min 35s ago
  Process: 20736 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
 Main PID: 20739 (postmaster)
    Tasks: 8 (limit: 11121)
   Memory: 16.4M
   CGroup: /system.slice/postgresql.service
           tq20739 /usr/bin/postmaster -D /var/lib/pgsql/data
           tq20740 postgres: logger process
           tq20742 postgres: checkpointer process
           tq20743 postgres: writer process
           tq20744 postgres: wal writer process
           tq20745 postgres: autovacuum launcher process
           tq20746 postgres: stats collector process
           mq20747 postgres: bgworker: logical replication launcher

Sep 26 09:42:01 localhost.localdomain systemd[1]: Starting PostgreSQL database server...
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.657 EDT [20739] LOG:  listening on IPv6 address "::1", port 5432
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.657 EDT [20739] LOG:  listening on IPv4 address "127.0.0.1", port 5432
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.663 EDT [20739] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.674 EDT [20739] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.696 EDT [20739] LOG:  redirecting log output to logging collector process
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.696 EDT [20739] HINT:  Future log output will appear in directory "log".
Sep 26 09:42:01 localhost.localdomain systemd[1]: Started PostgreSQL database server.
# systemctl stop postgresql
# systemctl status postgresql
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.657 EDT [20739] LOG:  listening on IPv6 address "::1", port 5432
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.657 EDT [20739] LOG:  listening on IPv4 address "127.0.0.1", port 5432
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.663 EDT [20739] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.674 EDT [20739] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.696 EDT [20739] LOG:  redirecting log output to logging collector process
Sep 26 09:42:01 localhost.localdomain postmaster[20739]: 2019-09-26 09:42:01.696 EDT [20739] HINT:  Future log output will appear in directory "log".
Sep 26 09:42:01 localhost.localdomain systemd[1]: Started PostgreSQL database server.
Sep 26 09:44:22 localhost.localdomain systemd[1]: Stopping PostgreSQL database server...
Sep 26 09:44:22 localhost.localdomain systemd[1]: postgresql.service: Killing process 20740 (postmaster) with signal SIGKILL.
Sep 26 09:44:22 localhost.localdomain systemd[1]: Stopped PostgreSQL database server.

postgresql 자동 시작 설정/설정 해제


# systemctl enable postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.

# systemctl list-unit-files --type=service |grep postgresql
postgresql.service                          enabled
[email protected]                         disabled
# systemctl disable postgresql
Removed /etc/systemd/system/multi-user.target.wants/postgresql.service.

# systemctl list-unit-files --type=service |grep postgresql
postgresql.service                          disabled
[email protected]                         disabled

각종 확인


# which postgres
/usr/bin/postgres

# which psql
/usr/bin/psql

# psql --version
psql (PostgreSQL) 10.6