PostgreSQL在线安装

背景:CentOS 7

一、在线yum安装

1 yum -y install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
2 yum -y install postgresql95-server stgresql95-odbc postgresql95-devel

二、初始化数据库

/usr/pgsql-9.5/bin/postgresql95-setup initdb

三、配置环境变量

1 export PKG_CONFIG_PATH=/usr/pgsql-9.5/lib/pkgconfig
2 export PATH=/usr/pgsql-9.5/bin:$PATH

四、添加开机启动

systemctl enable postgresql-9.5.service

五、启动服务

systemctl start postgresql-9.5.service
原文地址:https://www.cnblogs.com/yoyotl/p/6514074.html