更新包列表

sudo apt update

安装PostgreSQL

sudo apt install postgresql postgresql-client postgresql-contrib

修改配置文件

1.设置监听端口

vim /etc/postgresql/*/main/postgresql.conf
在这里插入图片描述

2.设置连接端口

vim /etc/postgresql/*/main/pg_hba.conf
在这里插入图片描述

加载本地文件并重启

systemctl reload postgresql ststemctl restart psotgresql

出现问题排查

systemctl status 'postgresql*'

更多推荐