Centos7安装PostgreSQL方法
1、确认操作系统的版本

2、操作系统是centos7 64位,安装对应的postgresql yum源
rpm -Uvh https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm

3、yum update
更新完成之后操作系统变成了最新版本的7.4

4、执行安装命令
yum install postgresql94-server postgresql94-contrib

5、检查是否安装成功
[root@client ~]# rpm -qa| grep postgres
postgresql94-libs-9.4.15-1PGDG.rhel7.x86_64
postgresql94-server-9.4.15-1PGDG.rhel7.x86_64
postgresql94-9.4.15-1PGDG.rhel7.x86_64
postgresql94-contrib-9.4.15-1PGDG.rhel7.x86_64

6、初始化数据库
/usr/pgsql-9.4/bin/postgresql94-setup initdb

7、启动服务并设置为开机启动
systemctl enable postgresql-9.4
systemctl start postgresql-9.4

8、访问PostgreSQL
su - postgres
输入命令psql将看到PostgrSQL的版本信息

9、设置postgres用户密码
postgres=# \password postgres
Enter new password:
Enter it again:
postgres=#
