系统版本:
centos7.2
# yum install readline-devel zlib-devel -y
如果不安装以上两个包,编译postgresql就会报缺少相应包的错误,导致无法通过。
# yum install postgresql-contrib
http://mirror.centos.org/centos/7/os/x86_64/Packages/uuid-devel-1.6.2-26.el7.x86_64.rpm
版本和系统的uuid版本一样,uuid-1.6.2-26.el7.x86_64
# rpm -ivh uuid-devel-1.6.2-26.el7.x86_64.rpm
如果不安装以上的一个包,编译postgresql就会报以下的错误:
# configure: error: library 'ossp-uuid' or 'uuid' is required for OSSP-UUID"
如果源里边有这个包,可以使用yum进行安装。
上传包postgresql-9.6.3.tar.gz
# tar -zxf postgresql-9.6.3.tar.gz
# cd postgresql-9.6.3
# ./configure --prefix=/usr/local/postgresql --with-ossp-uuid
# make && make install
# cd contrib/uuid-ossp
# make && make install
上边如果不编译uuid-ossp,就会出现下面的错误:
postgres=# create extension "uuid-ossp";
ERROR: could not open extension control file "/usr/local/postgresql/share/extension/uuid-ossp.control": No such file or directory
# vi /etc/profile
export PGHOME=/usr/local/postgresql
export PGDATA=/data/pg_data
export PATH=$PATH:$PGHOME/bin
# source /etc/profile
其他基本上和之前的yum安装的9.2版本的配置一样,注意配置文件可能不同,按实际的来配置,如下面的配置文件:
# find / -name "recovery.conf.sample"
/usr/local/postgresql/share/recovery.conf.sample
/data/postgresql-9.6.3/src/backend/access/transam/recovery.conf.sample
# cp /usr/local/postgresql/share/recovery.conf.sample /data/pg_data/recovery.conf