安装 postgresql [root@openbravo ~]# dnf module list postgresql 上次元数据过期检查:0:14:10 前,执行于 2019年11月14日 星期四 22时05分57秒。 CentOS-8 - AppStream Name Stream Profiles Summary postgresql 10 [d][e] client, server [d] PostgreSQL server and client module postgresql 9.6 client, server [d] PostgreSQL server and client module Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@openbravo ~]# dnf -y install postgresql postgresql-server 上次元数据过期检查:0:16:05 前,执行于 2019年11月14日 星期四 22时05分57秒。 依赖关系解决。 =================================================================================================================== 软件包 架构 版本 仓库 大小 =================================================================================================================== Installing: postgresql x86_64 10.6-1.module_el8.0.0+15+f57f353b AppStream 1.5 M postgresql-server x86_64 10.6-1.module_el8.0.0+15+f57f353b AppStream 5.1 M 安装依赖关系: libpq x86_64 10.5-1.el8 AppStream 188 k 事务概要 =================================================================================================================== 安装 3 软件包 总下载:6.7 M 安装大小:27 M 下载软件包: (1/3): libpq-10.5-1.el8.x86_64.rpm 180 kB/s | 188 kB 00:01 (2/3): postgresql-10.6-1.module_el8.0.0+15+f57f353b.x86_64.rpm 224 kB/s | 1.5 MB 00:06 (3/3): postgresql-server-10.6-1.module_el8.0.0+15+f57f353b.x86_64.rpm 355 kB/s | 5.1 MB 00:14 ------------------------------------------------------------------------------------------------------------------- 总计 430 kB/s | 6.7 MB 00:16 运行事务检查 事务检查成功。 运行事务测试 事务测试成功。 运行事务 准备中 : 1/1 Installing : libpq-10.5-1.el8.x86_64 1/3 Installing : postgresql-10.6-1.module_el8.0.0+15+f57f353b.x86_64 2/3 运行脚本 : postgresql-server-10.6-1.module_el8.0.0+15+f57f353b.x86_64 3/3 Installing : postgresql-server-10.6-1.module_el8.0.0+15+f57f353b.x86_64 3/3 运行脚本 : postgresql-server-10.6-1.module_el8.0.0+15+f57f353b.x86_64 3/3 验证 : libpq-10.5-1.el8.x86_64 1/3 验证 : postgresql-10.6-1.module_el8.0.0+15+f57f353b.x86_64 2/3 验证 : postgresql-server-10.6-1.module_el8.0.0+15+f57f353b.x86_64 3/3 已安装: postgresql-10.6-1.module_el8.0.0+15+f57f353b.x86_64 postgresql-server-10.6-1.module_el8.0.0+15+f57f353b.x86_64 libpq-10.5-1.el8.x86_64 完毕!
[root@openbravo ~]# su - postgres
上一次登录:四 11月 14 21:56:11 EST 2019tty1 上
[postgres@openbravo ~]$ postgresql-setup --initdb
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
打开网络监听
[root@openbravo ~]# vim /var/lib/pgsql/data/postgresql.conf
listen_addresses = '*'
[root@openbravo ~]# systemctl enable postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.
[root@openbravo ~]# systemctl status postgresql
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2019-11-15 00:18:46 EST; 4min 1s ago
Main PID: 5118 (postmaster)
Tasks: 8 (limit: 4595)
Memory: 16.1M
CGroup: /system.slice/postgresql.service
├─5118 /usr/bin/postmaster -D /var/lib/pgsql/data
├─5120 postgres: logger process
├─5122 postgres: checkpointer process
├─5123 postgres: writer process
├─5124 postgres: wal writer process
├─5125 postgres: autovacuum launcher process
├─5126 postgres: stats collector process
└─5127 postgres: bgworker: logical replication launcher
11月 15 00:18:46 openbravo systemd[1]: Starting PostgreSQL database server...
11月 15 00:18:46 openbravo postmaster[5118]: 2019-11-15 00:18:46.808 EST [5118] 日志: listening on IPv4 address ">
11月 15 00:18:46 openbravo postmaster[5118]: 2019-11-15 00:18:46.808 EST [5118] 日志: listening on IPv6 address ">
11月 15 00:18:46 openbravo postmaster[5118]: 2019-11-15 00:18:46.811 EST [5118] 日志: listening on Unix socket "/>
11月 15 00:18:46 openbravo postmaster[5118]: 2019-11-15 00:18:46.819 EST [5118] 日志: listening on Unix socket "/>
11月 15 00:18:46 openbravo postmaster[5118]: 2019-11-15 00:18:46.827 EST [5118] 日志: 日志输出重定向到日志收集进程
11月 15 00:18:46 openbravo postmaster[5118]: 2019-11-15 00:18:46.827 EST [5118] 提示: 后续的日志输出将出现在目录 >
11月 15 00:18:46 openbravo systemd[1]: Started PostgreSQL database server.
[root@openbravo ~]# su - postgres
上一次登录:五 11月 15 00:32:31 EST 2019pts/0 上
[postgres@openbravo ~]$ psql
psql (10.6)
输入 "help" 来获取帮助信息.
postgres=# \password
输入新的密码:
再次输入:
postgres=# \q
[postgres@openbravo ~]$
[root@openbravo ~]# vim /var/lib/pgsql/data/postgresql.conf
lc_numeric = 'zh_CN.UTF-8'
max_locks_per_transaction = 128
[root@openbravo ~]# systemctl restart postgresql