https://yum.postgresql.org/repopackages.php
sudo yum install http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-2.noarch.rpm -y
yum list postgresql*
useradd postgres
yum install postgresql10-server.x86_64
默认情况下,Postgresql安装目录是/usr/pgsql-10,而Postgresql的数据目录是/var/lib/pgsql/版本号/data目录
[root@localhost ~]# mkdir postgres /var/lib/pgsql/10/data
初始化数据库
[root@localhost ~]# /usr/pgsql-10/bin/postgresql-10-setup initdb
Initializing database … OK
[root@localhost ~]# su - postgres
[postgres@localhost ~]$ /usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data start