在CentOS 8上安装PostgreSQL 10(通过AppStream)
首先
使用Application Stream (AppStream) 在CentOS 8上安装PostgreSQL 10。
父篇:将来有计划创建
参考:RHEL 8的软件包结构 – BaseOS和Application Stream – 红帽工程师博客
支持
如果使用这种方法,根据《Red Hat Enterprise Linux 8 Application Streams Life Cycle – Red Hat Customer Portal》的说法,预计2024年5月为EOL(存在终止)日期。
之后可能不会对报告的漏洞和问题进行处理。
日志
安装
# 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
postgresql@.service 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
postgresql@.service disabled
确认的多种形式
# which postgres
/usr/bin/postgres
# which psql
/usr/bin/psql
# psql --version
psql (PostgreSQL) 10.6