1. 安装yum repo源
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-3.noarch.rpm
2. 更新repo缓存
yum makecache
3. 安装postgresql包
yum install postgresql96
yum install postgresql96-server
yum install postgresql96-contrib
yum install pgadmin3_96
4. 初始化和启动服务
service postgresql-9.6 initdb
chkconfig postgresql-9.6 on
service postgresql-9.6 start
5. 测试
su - postgres
psql