CentOS 8에 PostgreSQL 9.6 설치 (AppStream)

CentOS 8에 PostgreSQL 9.6 설치 (AppStream)

2022-10-05 last update

5 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 보다, 2021-11이 EOL이라고 생각된다.
그 이후에 보고된 취약성이나 결함에 대한 대응은 실시되지 않을 가능성이 있다.

LOG



설치


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

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

# /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:52:50 EDT; 3s ago
  Process: 22342 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
 Main PID: 22345 (postmaster)
    Tasks: 7 (limit: 11121)
   Memory: 15.3M
   CGroup: /system.slice/postgresql.service
           tq22345 /usr/bin/postmaster -D /var/lib/pgsql/data
           tq22346 postgres: logger process
           tq22348 postgres: checkpointer process
           tq22349 postgres: writer process
           tq22350 postgres: wal writer process
           tq22351 postgres: autovacuum launcher process
           mq22352 postgres: stats collector process

Sep 26 09:52:50 localhost.localdomain systemd[1]: Starting PostgreSQL database server...
Sep 26 09:52:50 localhost.localdomain postmaster[22345]: LOG:  redirecting log output to logging collector process
Sep 26 09:52:50 localhost.localdomain postmaster[22345]: HINT:  Future log output will appear in directory "pg_log".
Sep 26 09:52:50 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: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.
Sep 26 09:52:50 localhost.localdomain systemd[1]: Starting PostgreSQL database server...
Sep 26 09:52:50 localhost.localdomain postmaster[22345]: LOG:  redirecting log output to logging collector process
Sep 26 09:52:50 localhost.localdomain postmaster[22345]: HINT:  Future log output will appear in directory "pg_log".
Sep 26 09:52:50 localhost.localdomain systemd[1]: Started PostgreSQL database server.
Sep 26 09:53:31 localhost.localdomain systemd[1]: Stopping PostgreSQL database server...
Sep 26 09:53:31 localhost.localdomain systemd[1]: postgresql.service: Killing process 22346 (postmaster) with signal SIGKILL.
Sep 26 09:53:31 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) 9.6.10