下载
官网下载:https://www.postgresql.org/ftp/source/v9.6.3/
wget下载:wget https://ftp.postgresql.org/pub/source/v9.6.3/postgresql-9.6.3.tar.gz
安装前准备
配置用户和组
groupadd postgres
useradd postgres -g postgres
环境准备
yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++ openssl-devel cmake gcc* readline-devel
权限配置
mkdir /opt/postgres
chown -R postgres:postgres /opt/postgres/
配置环境变量
vi /etc/profile
#在文件末尾将以下环境变量添加进去
export PATH=/opt/postgres/bin:$PATH
export PGHOME=/opt/postgres
export PGDATA=/opt/postgres/data/
export LD_LIBRARY_PATH=