ITPub博客

首页 > 数据库 > 数据库开发技术 > postgresql和postgis插件安装

postgresql和postgis插件安装

原创 数据库开发技术 作者:hotdog04 时间:2015-11-24 14:42:08 0 删除 编辑

#################################
一、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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-03-11

  • 博文量
    59
  • 访问量
    404648