在CentOS 8上安装PostgreSQL 9.6(通过AppStream)
首先
使用Application Stream(AppStream)在CentOS8上安装PostgreSQL 10。
原文:暂未创建
参考:RHEL8的软件包结构 – BaseOS和Application Stream – 赤帽工程师博客
支持
如果使用这种方法进行引入,根据红帽企业 Linux 8 应用流生命周期 – 红帽客户门户网站,2021年11月被认为是终止支持 (EOL) 的。
此后,对于报告的漏洞和问题可能不会进行处理。
记录
安装
# 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
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) 9.6.10