#安装依赖:
yum install -y perl-ExtUtils-Embed readline readline-devel zlib zlib-devel openssl openssl-devel pam pam-devel libxml2 libxml2-devel libxslt libxslt-devel tcl tcl-devel openldap openldap-devel python python-devel gcc-c++ systemtap-sdt-devel.x86_64
#下载对应版本得源码包,本文安装的是9.6.0版本的:
https://www.postgresql.org/ftp/source/
#上传到服务器,然后解压
tar xf postgresql-9.6.0.tar
#切换到解压出来得目录:
cd postgresql-9.6.0
#安装:
./configure --prefix=/usr/local/psql --with-perl --with-tcl --with-python --with-openssl --with-pam --without-ldap --with-libxml --with-libxslt --enable-thread-safety --with-wal-blocksize=16 --with-blocksize=16 --enable-dtrace --enable-debug
#再有问题参考:
https://blog.youkuaiyun.com/luojinbai/article/details/44217551
#编译安装:
make && make install
#创建postgresql的用户:
useradd postgres
#设置密码: