postgresql 8.4.4-1 for linux x64,PostgreSQL 8.4 + PostGIS + Linux 的安装

今天弄了好久,终于把Postgis安装完成,Postgresql 8.4的安装请参考官方文档,这里不记录了,下面是Postgis 1.5的安装过程。

环境信息

Postgresql: 8.4.4

Postgis: 1.5.1

OS : Red Hat Enterprise 5

安装 proj-4.7.0

下载地址: http://trac.osgeo.org/proj/

1

2

3

4cd proj-4.7.0/

#./configure --prefix=/usr/local/pg_tool/proj

#make

#make install

安装 geos-3.2.2

下载地址: http://trac.osgeo.org/geos/

1

2

3

4#./configure --prefix=/usr/local/pg_tool/geos --enable-python --enable-ruby

#make

#make check

#make install

安装 postgis-1.5.1

下载地址:http://postgis.refractions.net/download/

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24./configure --prefix=/usr/local/pg_tool/postgis --with-pgconfig=/opt/pgsql/bin/pg_config --with-projdir=/usr/local/pg_tool/proj --with-geosconfig=/usr/local/pg_tool/geos/bin/geos-config

conigure 成功后,会出现以下界面:

PostGIS is now configured for i686-pc-linux-gnu

-------------- Compiler Info -------------

C compiler: gcc -g -O2

C++ compiler: g++ -g -O2

-------------- Dependencies --------------

GEOS config: /usr/local/pg_tool/geos/bin/geos-config

GEOS version: 3.2.2

PostgreSQL config: /opt/pgsql/bin/pg_config

PostgreSQL version: PostgreSQL 8.4.4

PROJ4 version: 47

Libxml2 config: /usr/bin/xml2-config

Libxml2 version: 2.6.26

PostGIS debug level: 0

-------- Documentation Generation --------

xsltproc: /usr/bin/xsltproc

xsl style sheets: /usr/share/sgml/docbook/xsl-stylesheets

dblatex:

convert: /usr/bin/convert

# make

# make check

# make install

说明:安装成功后会在目录$PGHOME/share/contrib/下产生一个名为postgis-1.5的目录。

测试

新建用户,表空间,数据库,language

1

2

3

4

5postgres=#create role postgis login with encrypted password 'postgis' nosuperuser nocreatedb nocreaterole noinherit ;

postgres=# create tablespace tbs_postgis_data owner postgis LOCATION '/opt/pgdata/tbs_postgis_data';

postgres=# create tablespace tbs_postgis_idx owner postgis LOCATION '/opt/pgdata/tbs_postgis_idx';

postgres=#create database postgis owner=postgis template=template0 ENCODING='UTF8' tablespace=tbs_postgis_data;

create language plpgsql;

新增加环境变量 ,修改文件 .bash_profile

1

2

3

4

5PROJ_HOME=/usr/local/pg_tool/proj

GEOS_HOME=/usr/local/pg_tool/geos

POSTGIS_HOME=/usr/local/pg_tool/postgis

LD_LIBRARY_PATH=$PGSQL_HOME/lib:$PROJ_HOME/lib:$GEOS_HOME/lib:$POSTGIS_HOME/lib

PATH=$PGSQL_HOME/bin:$PATH:$HOME/bin

编缉完成后,执行.bash_profile 立即生效。

载入 PostGIS 对象和函数

执行脚本 postgis.sql

1

2cd $PGHOME/share/contrib/postgis-1.5

$ psql -d postgis -f postgis.sql > 1.out

说明: 本人在这里执行不成功,报以下ERROR,

1

2psql:postgis.sql:59: ERROR: could not load library "/opt/pgsql/lib/postgis-1.5.so":

libgeos_c.so.1: cannot open shared object file: No such file or directory

查了相关文档,说是要配置环境变量 LD_LIBRARY_PATH 的 proj 和 geos 的库的路径, 但按照要求配置,还是不成功,从错误提示上看,脚本找不到libgeos_c.so.1文件,这个文件在 $GEOS_HOME/lib 目录下,折腾了好久都不成功;最后根据提示,将文件libgeos_c.so.1 COPY到目录/opt/pgsql/lib后,然后再次执行 psql -d postgis -f postgis.sql,终于成功了但为什么程序不会从LD_LIBRARY_PATH找呢?非常奇怪,以后要是有哪位读者知道的话,可以留言给我,谢谢!

执行脚本 spatial_ref_sys

1psql -d [yourdatabase] -f spatial_ref_sys.sql

关于文档

Postgis的详细介绍,在安装包里有非常详细的HTML文档,包括安装,使用,和常见问题等.

目录: postgis-1.5.1dochtml

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值