安装教程官方地址:https://www.postgresql.org/download/linux/redhat/
1. 选择PostgreSQL版本;
2. 选择要安装的平台;
3. 选择32位还是64位;
4. 复制安装RPM;
yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
5. 直接安装服务器端;
yum install postgresql10-server
6. 初始化数据库并将postgresql注册为自己启动;
/usr/pgsql-10/bin/postgresql-10-setup initdb systemctl enable postgresql-10 systemctl start postgresql-10
PostgreSQL的默认数据库路径为: /var/lib/pgsql/10/data
参考链接: https://www.jianshu.com/p/d26ae43446a2