1.安装源
yum install http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-2.noarch.rpm
2.安装库
yum install postgresql95-server postgresql95-contrib
3.初始化
/usr/pgsql-9.5/bin/postgresql95-setup initdb
4.开机启动
systemctl enable postgresql-9.5.service
5.启动
systemctl start postgresql-9.5.service
原文:http://www.cnblogs.com/swbzmx/p/5998389.html