检查PostGIS、PostgreSQL、GEOS、GDAL、PROJ等各软件的版本依赖关系
1. 创建postgres用户和组
# groupadd -g 101dba
# useradd-u 501 -g dba -G root -d /usr/local/pgsql postgres
2. 添加postgres用户环境变量
$ cat ~/.bash_profile
# .bash_profile
# Get the aliases and functionsif [ -f ~/.bashrc ]; then.~/.bashrcfi# User specific environment and startup programs
export PGHOME=/usr/local/pgsql
export PGDATA=/usr/local/pgsql/data
export PATH=$PGHOME/bin:$PATH:$HOME/bin
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export DATE=`date +"%Y%m%d%H%M"`
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S>"
3. 调整系统参数
# tail -n 12 /etc/sysctl.conf
vm.overcommit_memory=1vm.overcommit_ratio=90fs.aio-max-nr=1048576fs.file-max= 7672460net.ipv4.ip_local_port_range=9000 65500net.core.rmem_default=262144net.core.rmem_max=4194304net.core.wmem_default=262144net.core.wmem_max=1048586kernel.sem= 50100 64128000 50100 1280kernel.shmall=5242880kernel.shmmax=12884901888#tail -n 4 /etc/security/limits.conf
postgres soft nproc8192postgres hard nproc16384postgres soft nofile4096postgres hard nofile65536
4. 安装依赖包
# yum install -y python-devel perl-ExtUtils-Embed python-devel gcc-c++ openssl-devel readline readline-devel bzip2 zlib zlib-devel openssl openssl-devel pam pam-devel libxml2 libxml2-devel libxslt libxslt-devel openldap openldap-devel libgeos-dev libproj-dev libgdal-dev xsltproc docbook-xsl docbook-xml imagemagick libmagickcore-dev dblatex tcl tcl-devel unixODBC unixODBC-devel libpng12 libpng12-devel
5. 安装PostgreSQL
修改源码文件s