安装
sudo dnf install -y vim bash-completion wget
sudo dnf update -y
#sudo reboot
sudo dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-31-x86_64/pgdg-fedora-repo-latest.noarch.rpm
sudo dnf install postgresql12-server postgresql12
sudo /usr/pgsql-12/bin/postgresql-12-setup initdb
sudo systemctl enable --now postgresql-12
systemctl status postgresql-12
#sudo firewall-cmd --add-service=postgresql --permanent
#sudo firewall-cmd --reload
修改配置及重启服务
$ sudo vim /var/lib/pgsql/12/data/postgresql.conf
listen_addresses = "*"$ sudo vim /var/lib/pgsql/11/data/pg_hba.conf
# Accept from anywhere
host all all 0.0.0.0/0 md5# Accept from trusted subnet
host all all 10.10.10.0/24 md5$ sudo systemctl restart postgresql-12
设置管理员密码
sudo su - postgres
psql -c "alter user postgres with password "StrongPassword""
安装pgAdmin 4网端管理器
https://computingforgeeks.com/how-to-install-pgadmin-on-centos-fedora/