CentOS编译postgresql源码,以及安装pg依赖包

首先,解压pg10压缩包:html

tar -zxvf pg10.tar.gz

configure 安装(这里写了一个安装脚本shell,pg_con.sh ),python

执行pg_con.sh 详情请移步:https://blog.csdn.net/liguangxianbin/article/details/79699132c++

一键安装所需软件包脚本:sql

install.shshell

#!/bin/bash   

yum install bison \
flex \
readline-devel \
zlib-devel \
openssl-devel \
libxml2-devel \
libxslt-devel \
uuid-devel \
openldap-devel \
python-devel \
krb5-devel \
tcl-devel \
pam-devel \
gettext-devel \
gcc-c++ \
gtk2-devel \
automake \
gettext\
perl-ExtUtils-Embed \

 

 

出现问题1:bash

configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure.  It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.

安装readline-devel:ssh

yum -y install readline readline-devel

出现问题2:flex

configure: error: zlib library not found
If you have zlib already installed, see config.log for details on the
failure.  It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support.

安装zlib-develui

yum -y install zlib zlib-devel

出现问题3:spa

configure: error: library 'crypto' is required for OpenSSL

安装:

yum -y install openssl opesnssl-devel

出现问题4:

 

checking for xmlSaveToBuffer in -lxml2... no
configure: error: library 'xml2' (version >= 2.6.23) is required for XML support

安装:

yum -y install libxml2 libxml2-devel

出现问题5:

checking for xsltCleanupGlobals in -lxslt... no
configure: error: library 'xslt' is required for XSLT support

安装:

yum install libxslt libxslt-devel

若是出现问题6:

error:NLS is requires msg

安装:

yum -y install gettext

若是出现问题7:

error: SSL is required openssl

安装:

yum -y install libssl libssl-devel
yum -y install libssh linssh-devel

若是出现问题8:

URCE -I/usr/include/libxml2   -c -o zhparser.o zhparser.c
In file included from zhparser.c:8:0:
zhparser.h:8:18: 致命错误:scws.h:没有那个文件或目录
 #include "scws.h"
编译中断。

安装:

export SCWS_HOME=/usr/local,wget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2
tar -jxvf scws-1.2.3.tar.bz2
cd scws-1.2.3/
./configure --prefix=/usr/local/scws (或者直接 ./configure 默认,而后添加环境变量 export SCWS_HOME=/usr/local,
 

 export LD_LIBRARY_PATH=/opt/HighGo/Develop/lib

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/scws/lib

)makemake install

若是出现问题9:

 

 

同问题8:scws中文分词没有安装上或者没有设置环境变量。

问题9:

安装 perl-ExtUtils-Embed

yum install perl-ExtUtils-Embed

 

而后进入源码文件中:

 

进入到contrib(pg插件)文件中。

make
make install

 

而后进入到/opt/Develop/bin

 

./initdb -D ../data 
./pg_ctl -D ../data start\stop\restart
./createdb my_db
./psql my_db