postgresql和postgis插件安装

#################################
一、postgresql安装:
#################################
1、依赖包安装:
依赖包检查:
yum install  gcc perl-ExtUtils-Embed  readline-devel zlib-devel python-devel -y
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \
perl-ExtUtils-Embed \
readline \
readline-devel \
zlib \
zlib-devel \
python-devel \
gcc \
libaio \
libaio-devel \
make \
gcc-c++ \
openssl \
openssl-devel \
sysstat | grep -i not

依赖包安装:
yum install perl-ExtUtils-Embed readline readline-devel zlib zlib-devel python-devel gcc gcc-c++ libaio libaio-devel make sysstat openssl openssl-devel -y

2、编译安装postgresql:
cd /disk1/soft/postgresql-9.4.4
./configure --prefix=/usr/local/pgsql9.4.4 --with-perl --with-python --with-libxml --with-openssl --with-pam  --with-libxslt --with-segsize=4 --with-wal-segsize=64
make
make install

3、编译安装contrib:
cd /disk1/soft/postgresql-9.4.4/contrib
make all
make install


#################################
二、postgis安装:
#################################
1、依赖包编译安装:
proj4:     proj.4-4.7.0
./configure --prefix=/usr/local/postgis
make
make install

GEOS:      geos-3.5.0
./configure --prefix=/usr/local/postgis
make
make install

 

LibXML2 : libxml2-2.9.2
./configure --prefix=/usr/local/postgis
make
make install


JSON-C  :  json-c-json-c-0.12
./configure --prefix=/usr/local/postgis
make
make install


GDAL:      gdal-2.0.0
./configure --prefix=/usr/local/postgis
make
make install

2、编译安装postgis:
./configure  --with-pgconfig=/usr/local/pgsql9.4.4/bin/pg_config

./configure  --with-pgconfig=/usr/local/pgsql9.4.4/bin/pg_config --with-gdalconfig=/usr/local/postgis/bin/gdal-config \
--with-geosconfig=/usr/local/postgis/bin/geos-config --with-xml2config=/usr/local/postgis/bin/xml2-config \
--with-projdir=/usr/local/postgis  --with-jsondir=/usr/local/postgis --with-libiconv=/usr/bin  \
--with-raster --with-topology --with-gettext=no
make
make install


#######################
三、数据库实例安装
#######################
1、添加动态链接库:
echo "/usr/local/postgis/lib/" >> /etc/ld.so.conf
ldconfig

2、添加软连接:
cd /usr/local
ln -s pgsql9.4.4 pgsql

 

3、添加环境变量:
su - postgres
vi .bash_profile
PATH=$PATH:$HOME/bin:/usr/local/pgsql/bin
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH

. .bash_profile

4、安装启动:
安装:
initdb  -D /disk1/pg7001

修改配置文件端口为7001:
vi postgresql.conf
port=7001
启动:
pg_ctl -D /disk1/pg7001

5、登录测试postgis插件是否正常:
psql -p 7001
postgres=# create database test;
CREATE DATABASE
postgres=# \c test;
You are now connected to database "test" as user "postgres".
test=# create extension postgis;
CREATE EXTENSION
查看插件安装视图:
select *from pg_available_extensions;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20625855/viewspace-1845425/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/20625855/viewspace-1845425/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值