ITPub博客

首页 > 数据库 > 国内数据库 > postgres install + postgis install(二)

postgres install + postgis install(二)

原创 国内数据库 作者:jack22220613 时间:2015-05-09 09:56:21 0 删除 编辑
续上篇  postgres install + postgis install(一),继续介绍安装过程以及问题处理。

2、安装 proj-4.8.0

[root@cdh3 data]# tar -xvzf /root/rpm\(64\)/proj-4.8.0.tar.gz

[root@cdh3 data]# cd proj-4.8.0/
[root@cdh3 proj-4.8.0]#
[root@cdh3 proj-4.8.0]# cd ..
[root@cdh3 data]# mv proj-4.8.0/ soft_proj-4.8.0/
[root@cdh3 data]#
[root@cdh3 data]# cd soft_proj-4.8.0/
[root@cdh3 soft_proj-4.8.0]#
[root@cdh3 soft_proj-4.8.0]# ./configure --prefix=/data/proj-4.8.0

configure 通过

[root@cdh3 soft_proj-4.8.0]# make
[root@cdh3 soft_proj-4.8.0]# make install

make & make install 均通过

[root@cdh3 proj-4.8.0]# cd /data/proj-4.8.0/bin/
cs2cs    geod     invgeod  invproj  nad2bin  proj     
[root@cdh3 proj-4.8.0]#
[root@cdh3 proj-4.8.0]# ll /etc/ld.so.conf.d/proj-4.8.0.conf
ls: 无法访问/etc/ld.so.conf.d/proj-4.8.0.conf: 没有那个文件或目录
[root@cdh3 proj-4.8.0]#
[root@cdh3 proj-4.8.0]# touch /etc/ld.so.conf.d/proj-4.8.0.conf
[root@cdh3 proj-4.8.0]#
[root@cdh3 proj-4.8.0]# vi /etc/ld.so.conf.d/proj-4.8.0.conf
/data/proj-4.8.0/lib

[root@cdh3 proj-4.8.0]# ldconfig
[root@cdh3 proj-4.8.0]#
[root@cdh3 proj-4.8.0]#

3、安装geos-3.3.9
[root@cdh3 ~]# cd /data
[root@cdh3 data]# tar -xvjf /root/rpm\(64\)/geos-3.3.9.tar.bz2
[root@cdh3 data]# mv geos-3.3.9/ soft_geos-3.3.9
[root@cdh3 data]# cd soft_geos-3.3.9/
[root@cdh3 soft_geos-3.3.9]# ./configure --prefix=/data/geos-3.3.9
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
.......................
make[4]: Entering directory `/data/soft_geos-3.3.9/src/algorithm/locate'
source='IndexedPointInAreaLocator.cpp' object='IndexedPointInAreaLocator.lo' libtool=yes \
        DEPDIR=.deps depmode=none /bin/sh ../../../depcomp \
        /bin/sh ../../../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../include -I../../../include/geos -I../../../include    -DGEOS_INLINE  -pedantic -Wall -ansi -Wno-long-long  -ffloat-store  -c -o IndexedPointInAreaLocator.lo IndexedPointInAreaLocator.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../../include -I../../../include/geos -I../../../include -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -ffloat-store -c IndexedPointInAreaLocator.cpp  -o .libs/IndexedPointInAreaLocator.o
../../../libtool: line 1128: g++: command not found
make[4]: *** [IndexedPointInAreaLocator.lo] 错误 1
make[4]: Leaving directory `/data/soft_geos-3.3.9/src/algorithm/locate'
make[3]: *** [all-recursive] 错误 1
make[3]: Leaving directory `/data/soft_geos-3.3.9/src/algorithm/locate'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/data/soft_geos-3.3.9/src/algorithm'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/data/soft_geos-3.3.9/src'
make: *** [all-recursive] 错误 1

出现很多错误,原因是系统缺少 开发包

[root@cdh3 soft_geos-3.3.9]# yum groupinstall 'Development Tools'

继续make
[root@cdh3 soft_geos-3.3.9]# make
。。。。。。。。
../../../include/geos/geom/Coordinate.inl: In member function 'bool geos::geom::Coordinate::isNull() const':
../../../include/geos/geom/Coordinate.inl:39: error: 'ISNAN' was not declared in this scope
../../../include/geos/geom/Coordinate.inl: In member function 'bool geos::geom::Coordinate::equals3D(const geos::geom::Coordinate&) const':
../../../include/geos/geom/Coordinate.inl:83: error: 'ISNAN' was not declared in this scope
make[4]: *** [IndexedPointInAreaLocator.lo] 错误 1
make[4]: Leaving directory `/data/soft_geos-3.3.9/src/algorithm/locate'
make[3]: *** [all-recursive] 错误 1
make[3]: Leaving directory `/data/soft_geos-3.3.9/src/algorithm/locate'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/data/soft_geos-3.3.9/src/algorithm'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/data/soft_geos-3.3.9/src'
make: *** [all-recursive] 错误 1
[root@cdh3 soft_geos-3.3.9]#

isnan错误,继续下面的安装,先安装其它依赖,回来后继续make

4、安装gdal-1.11.1
[root@cdh3 data]# tar -xvzf /root/rpm\(64\)/gdal-1.11.1.tar.gz
[root@cdh3 data]# mv gdal-1.11.1/ soft_gdal-1.11.1
[root@cdh3 data]# cd soft_gdal-1.11.1/
[root@cdh3 soft_gdal-1.11.1]# ./configure --prefix=/data/gdal-1.11.1
checking build system type... x86_64-unknown-linux-gnu
............
[root@cdh3 soft_gdal-1.11.1]# make
[root@cdh3 soft_gdal-1.11.1]# make install
make & make install 通过

[root@cdh3 soft_gdal-1.11.1]# touch /etc/ld.so.conf.d/gdal-1.11.1.conf
[root@cdh3 soft_gdal-1.11.1]# vi /etc/ld.so.conf.d/gdal-1.11.1.conf
/data/gdal-1.11.1/lib

[root@cdh3 soft_gdal-1.11.1]# ldconfig
[root@cdh3 soft_gdal-1.11.1]#

5、继续 安装geos-3.3.9

[root@cdh3 soft_gdal-1.11.1]# cd ../soft_geos-3.3.9/
[root@cdh3 soft_geos-3.3.9]# ./configure --prefix=/data/geos-3.3.9
。。。。。。。。。。。。
[root@cdh3 soft_geos-3.3.9]# make
[root@cdh3 soft_geos-3.3.9]# make install
make & make install 通过,中间可能安装过其它系统包(比如: gcc-c++-devel/flex/bsion,忘记了。。查到之后再补充
)或者就是安装了gdal后就好了。。

[root@cdh3 soft_geos-3.3.9]# touch /etc/ld.so.conf.d/geos-3.3.9.conf
[root@cdh3 soft_geos-3.3.9]# vi /etc/ld.so.conf.d/geos-3.3.9.conf
/data/geos-3.3.9/lib

6、安装postgis-2.1.7
[root@cdh3 data]# tar -xvzf /root/rpm\(64\)/postgis-2.1.7.tar.gz
[root@cdh3 postgis-2.1.7]# ./configure --with-pgconfig=/data/postgresql-9.3.5/bin/pg_config --with-geosconfig=/data/geos-3.3.9/bin/geos-config  --with-projdir=/data/proj-4.8.0/
...........
checking for PQserverVersion in -lpq... yes
checking for xml2-config... no
configure: error: could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter.

缺少xml2

7、安装libxml2
[root@cdh3 postgis-2.1.7]# rpm -ivh /root/rpm\(64\)/xerces-c-3.0.1-20.el6.x86_64.rpm
warning: /root/rpm(64)/xerces-c-3.0.1-20.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:xerces-c               ########################################### [100%]
[root@cdh3 postgis-2.1.7]#
[root@cdh3 postgis-2.1.7]#
[root@cdh3 postgis-2.1.7]# rpm -ivh /root/rpm\(64\)/xerces-c-3.0.1-20.el6.x86_64.rpm
warning: /root/rpm(64)/xerces-c-3.0.1-20.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:xerces-c               ########################################### [100%]
[root@cdh3 postgis-2.1.7]# yum install libxml2-devel-2.7.6-8.el6_3.4
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
CentOS6.4                                                                                             | 4.0 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libxml2-devel.x86_64 0:2.7.6-8.el6_3.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                        Arch                    Version                             Repository                  Size
=============================================================================================================================
Installing:
 libxml2-devel                  x86_64                  2.7.6-8.el6_3.4                     CentOS6.4                  1.1 M

Transaction Summary
=============================================================================================================================
Install       1 Package(s)

Total download size: 1.1 M
Installed size: 8.5 M
Is this ok [y/N]: y
Downloading Packages:
libxml2-devel-2.7.6-8.el6_3.4.x86_64.rpm                                                              | 1.1 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : libxml2-devel-2.7.6-8.el6_3.4.x86_64                                                                      1/1
Unable to connect to dbus
  Verifying  : libxml2-devel-2.7.6-8.el6_3.4.x86_64                                                                      1/1

Installed:
  libxml2-devel.x86_64 0:2.7.6-8.el6_3.4                                                                                     

Complete!
[root@cdh3 postgis-2.1.7]#
[root@cdh3 postgis-2.1.7]# ./configure --with-pgconfig=/data/postgresql-9.3.5/bin/pg_config --with-geosconfig=/data/geos-3.3.9/bin/geos-config  --with-projdir=/data/proj-4.8.0/
。。。。。。。。。

  PostGIS is now configured for x86_64-unknown-linux-gnu

 -------------- Compiler Info -------------
  C compiler:           gcc -g -O2
  C++ compiler:         g++ -g -O2
  SQL preprocessor:     /usr/bin/cpp -w -traditional-cpp -P

 -------------- Dependencies --------------
  GEOS config:          /data/geos-3.3.9/bin/geos-config
  GEOS version:         3.3.9
  GDAL config:          /data/gdal-1.11.1/bin/gdal-config
  GDAL version:         1.11.1
  PostgreSQL config:    /data/pgsql-9.3.5/bin/pg_config
  PostgreSQL version:   PostgreSQL 9.3.5
  PROJ4 version:        48
  Libxml2 config:       /usr/bin/xml2-config
  Libxml2 version:      2.7.6
  JSON-C support:       no
  PostGIS debug level:  0
  Perl:                 /usr/bin/perl

 --------------- Extensions ---------------
  PostGIS Raster:       enabled
  PostGIS Topology:     enabled
  SFCGAL support:       disabled

 -------- Documentation Generation --------
  xsltproc:             /usr/bin/xsltproc
  xsl style sheets:     
  dblatex:              
  convert:              
  mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd

缺少   JSON-C support:       no    的支持

[root@cdh3 postgis-2.1.7]#
[root@cd
[root@cdh3 data]# cd json-c-json-c-0.11-20130402/
[root@cdh3 json-c-json-c-0.11-20130402]# ./configure --prefix=/data/json-c-0.11
make & make install  后 ,
[root@cdh3 json-c-json-c-0.11-20130402]# touch /etc/ld.so.conf.d/json-c-0.11.conf
[root@cdh3 json-c-json-c-0.11-20130402]# vi /etc/ld.so.conf.d/json-c-0.11.conf
/data/json-c-0.11/lib

[root@cdh3 json-c-json-c-0.11-20130402]# ldconfig
[root@cdh3 json-c-json-c-0.11-20130402]#
[root@cdh3 json-c-json-c-0.11-20130402]# vi ~/.bash_profile
# .bash_profile

# Get the aliases and functions
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export PROJHOME=/data/proj-4.8.0
export GEOSHOME=/data/geos-3.3.9
export GDALHOME=/data/gdal-1.11.1
export PATH=$PROJHOME/bin:$GEOSHOME/bin:$GDALHOME/bin:$PATH
export LD_LIBRARY_PATH=$PROJHOME/lib:$GEOSHOME/lib:$GDALHOME/lib:/lib64:/lib


[root@cdh3 json-c-json-c-0.11-20130402]#
[root@cdh3 json-c-json-c-0.11-20130402]# ldconfig
[root@cdh3 json-c-json-c-0.11-20130402]# . ~/.bash_profile

继续安装postgis-2.1.7
[root@cdh3 postgis-2.1.7]# ./configure --with-pgconfig=/data/postgres-9.3.5/bin/pg_config --with-geosconfig=/data/geos-3.3.9/bin/geos-config  --with-projdir=/data/proj-4.8.0/ --with-jsondir=/data/json-c-0.11/

....................
-------------- Compiler Info -------------
  C compiler:           gcc -g -O2
  C++ compiler:         g++ -g -O2
  SQL preprocessor:     /usr/bin/cpp -w -traditional-cpp -P

 -------------- Dependencies --------------
  GEOS config:          /data/geos-3.3.9/bin/geos-config
  GEOS version:         3.3.9
  GDAL config:          /data/gdal-1.11.1/bin/gdal-config
  GDAL version:         1.11.1
  PostgreSQL config:    /data/pgsql-9.3.5/bin/pg_config
  PostgreSQL version:   PostgreSQL 9.3.5
  PROJ4 version:        48
  Libxml2 config:       /usr/bin/xml2-config
  Libxml2 version:      2.7.6
  JSON-C support:       yes
  PostGIS debug level:  0
  Perl:                 /usr/bin/perl

 --------------- Extensions ---------------
  PostGIS Raster:       enabled
  PostGIS Topology:     enabled
  SFCGAL support:       disabled

 -------- Documentation Generation --------
  xsltproc:             /usr/bin/xsltproc
  xsl style sheets:     
  dblatex:              
  convert:              
  mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd

[root@cdh3 postgis-2.1.7]# make
.......
make[1]: Leaving directory `/data/postgis-2.1.7/extensions'
PostGIS was built successfully. Ready to install.

make 成功

以下两个make可以不需要
[root@cdh3 postgis-2.1.7]#
[root@cdh3 postgis-2.1.7]# make comments
make -C doc comments
make[1]: Entering directory `/data/postgis-2.1.7/doc'
make[1]: Nothing to be done for `comments'.
make[1]: Leaving directory `/data/postgis-2.1.7/doc'
[root@cdh3 postgis-2.1.7]#
[root@cdh3 postgis-2.1.7]# make cheatsheets
make -C doc cheatsheets
。。。。

[root@cdh3 postgis-2.1.7]# make install
。。。。。
make[2]: Leaving directory `/data/postgis-2.1.7/extensions/postgis_topology'
make[1]: Leaving directory `/data/postgis-2.1.7/extensions'

make install 成功

8、配置postgres+postgis
[root@cdh3 postgis-2.1.7]# su - postgres
[postgres@cdh3 ~]$
[postgres@cdh3 ~]$ psql
psql (9.3.5)
Type "help" for help.

postgres=# SELECT name, default_version,installed_version FROM pg_available_extensions WHERE name LIKE 'postgis%' ;
          name          | default_version | installed_version
------------------------+-----------------+-------------------
 postgis                | 2.1.7           |
 postgis_tiger_geocoder | 2.1.7           |
 postgis_topology       | 2.1.7           |
(3 rows)

postgres=#
postgres=#

postgres=# CREATE EXTENSION postgis;
CREATE EXTENSION
postgres=#
postgres=# CREATE EXTENSION postgis_topology;
CREATE EXTENSION
postgres=# CREATE EXTENSION postgis_tiger_geocoder;
ERROR:  required extension "fuzzystrmatch" is not installed
STATEMENT:  CREATE EXTENSION postgis_tiger_geocoder;
ERROR:  required extension "fuzzystrmatch" is not installed
postgres=#
postgres=# SELECT name, default_version,installed_version FROM pg_available_extensions WHERE name LIKE 'postgis%' ;
          name          | default_version | installed_version
------------------------+-----------------+-------------------
 postgis                | 2.1.7           | 2.1.7
 postgis_tiger_geocoder | 2.1.7           |
 postgis_topology       | 2.1.7           | 2.1.7
(3 rows)

postgres=#
postgres=# CREATE EXTENSION fuzzystrmatch;
ERROR:  could not open extension control file "/data/pgsql-9.3.5/share/extension/fuzzystrmatch.control": 没有那个文件或目录
STATEMENT:  CREATE EXTENSION fuzzystrmatch;
ERROR:  could not open extension control file "/data/pgsql-9.3.5/share/extension/fuzzystrmatch.control": 没有那个文件或目录
postgres=#
postgres=#

postgis_tiger_geocoder 这个extension安装失败,postgis-2.1.7官方文档没有写解决办法,后来自己找来找去、试来试去就成功了。

[root@cdh3 postgresql-9.3.5]# cd contrib/
[root@cdh3 contrib]# ls
adminpack          cube            hstore    pageinspect        pg_standby          pg_xlogdump    tablefunc    xml2
auth_delay         dblink          intagg    passwordcheck      pg_stat_statements  postgres_fdw   tcn
auto_explain       dict_int        intarray  pg_archivecleanup  pgstattuple         README         test_parser
btree_gin          dict_xsyn       isn       pgbench            pg_test_fsync       seg            tsearch2
btree_gist         dummy_seclabel  lo        pg_buffercache     pg_test_timing      sepgsql        unaccent
chkpass            earthdistance   ltree     pgcrypto           pg_trgm             spi            uuid-ossp
citext             file_fdw        Makefile  pg_freespacemap    pg_upgrade          sslinfo        vacuumlo
contrib-global.mk  fuzzystrmatch   oid2name  pgrowlocks         pg_upgrade_support  start-scripts  worker_spi
[root@cdh3 contrib]#
[root@cdh3 contrib]# ll
总用量 228
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 adminpack
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 auth_delay
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 auto_explain
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 btree_gin
drwxrwxrwx 5 postgres postgres 4096 7月  22 2014 btree_gist
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 chkpass
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 citext
-rw-r--r-- 1 postgres postgres   85 7月  22 2014 contrib-global.mk
drwxrwxrwx 5 postgres postgres 4096 7月  22 2014 cube
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 dblink
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 dict_int
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 dict_xsyn
drwxrwxrwx 2 postgres postgres 4096 5月   7 16:00 dummy_seclabel
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 earthdistance
drwxrwxrwx 7 postgres postgres 4096 7月  22 2014 file_fdw
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 fuzzystrmatch
drwxrwxrwx 5 postgres postgres 4096 7月  22 2014 hstore
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 intagg
drwxrwxrwx 6 postgres postgres 4096 7月  22 2014 intarray
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 isn
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 lo
drwxrwxrwx 5 postgres postgres 4096 7月  22 2014 ltree
-rw-r--r-- 1 postgres postgres 1251 7月  22 2014 Makefile
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 oid2name
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pageinspect
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 passwordcheck
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_archivecleanup
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pgbench
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_buffercache
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 pgcrypto
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_freespacemap
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pgrowlocks
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_standby
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_stat_statements
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 pgstattuple
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_test_fsync
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_test_timing
drwxrwxrwx 5 postgres postgres 4096 7月  22 2014 pg_trgm
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_upgrade
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_upgrade_support
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 pg_xlogdump
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 postgres_fdw
-rw-r--r-- 1 postgres postgres 1133 7月  22 2014 README
drwxrwxrwx 5 postgres postgres 4096 7月  22 2014 seg
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 sepgsql
drwxrwxrwx 2 postgres postgres 4096 5月   7 16:00 spi
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 sslinfo
drwxrwxrwx 3 postgres postgres 4096 7月  22 2014 start-scripts
drwxrwxrwx 5 postgres postgres 4096 7月  22 2014 tablefunc
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 tcn
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 test_parser
drwxrwxrwx 5 postgres postgres 4096 7月  22 2014 tsearch2
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 unaccent
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 uuid-ossp
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 vacuumlo
drwxrwxrwx 2 postgres postgres 4096 7月  22 2014 worker_spi
drwxrwxrwx 4 postgres postgres 4096 7月  22 2014 xml2
[root@cdh3 contrib]#
[root@cdh3 contrib]# llhstore
-bash: llhstore: command not found
[root@cdh3 contrib]# ll hstore
总用量 164
-rw-r--r-- 1 postgres postgres  3983 7月  22 2014 crc32.c
-rw-r--r-- 1 postgres postgres   255 7月  22 2014 crc32.h
drwxrwxrwx 2 postgres postgres  4096 7月  22 2014 data
drwxrwxrwx 2 postgres postgres  4096 7月  22 2014 expected
-rw-r--r-- 1 postgres postgres   280 7月  22 2014 hstore--1.0--1.1.sql
-rw-r--r-- 1 postgres postgres  1201 7月  22 2014 hstore--1.1--1.2.sql
-rw-r--r-- 1 postgres postgres 12646 7月  22 2014 hstore--1.2.sql
-rw-r--r-- 1 postgres postgres 10706 7月  22 2014 hstore_compat.c
-rw-r--r-- 1 postgres postgres   158 7月  22 2014 hstore.control
-rw-r--r-- 1 postgres postgres  5198 7月  22 2014 hstore_gin.c
-rw-r--r-- 1 postgres postgres 12992 7月  22 2014 hstore_gist.c
-rw-r--r-- 1 postgres postgres  7094 7月  22 2014 hstore.h
-rw-r--r-- 1 postgres postgres 32132 7月  22 2014 hstore_io.c
-rw-r--r-- 1 postgres postgres 28288 7月  22 2014 hstore_op.c
-rw-r--r-- 1 postgres postgres  5493 7月  22 2014 hstore--unpackaged--1.0.sql
-rw-r--r-- 1 postgres postgres   505 7月  22 2014 Makefile
drwxrwxrwx 2 postgres postgres  4096 7月  22 2014 sql
[root@cdh3 contrib]# cd fuzzystrmatch/
[root@cdh3 fuzzystrmatch]# ll
总用量 84

发现在 posgres-9.3.5的contrib下有这个需要的fuzzystrmatch,但编译安装过程中,没有涉及到此extension,于是我就自己make了一次,就这样可以了。

[root@cdh3 fuzzystrmatch]# make
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -I. -I. -I../../src/include -D_GNU_SOURCE   -c -o fuzzystrmatch.o fuzzystrmatch.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -I. -I. -I../../src/include -D_GNU_SOURCE   -c -o dmetaphone.o dmetaphone.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -shared -o fuzzystrmatch.so fuzzystrmatch.o dmetaphone.o -L../../src/port -L../../src/common -Wl,--as-needed -Wl,-rpath,'/data/postgresql-9.3.5/lib',--enable-new-dtags  
[root@cdh3 fuzzystrmatch]#


[root@cdh3 fuzzystrmatch]# make install
/bin/mkdir -p '/data/postgresql-9.3.5/lib'
/bin/mkdir -p '/data/postgresql-9.3.5/share/extension'
/bin/mkdir -p '/data/postgresql-9.3.5/share/extension'
/usr/bin/install -c -m 755  fuzzystrmatch.so '/data/postgresql-9.3.5/lib/fuzzystrmatch.so'
/usr/bin/install -c -m 644 ./fuzzystrmatch.control '/data/postgresql-9.3.5/share/extension/'
/usr/bin/install -c -m 644 ./fuzzystrmatch--1.0.sql ./fuzzystrmatch--unpackaged--1.0.sql  '/data/postgresql-9.3.5/share/extension/'
[root@cdh3 fuzzystrmatch]#

make install后生成了需要的 extension;
[root@cdh3 fuzzystrmatch]# ll /data/postgresql-9.3.5/share/extension/
fuzzystrmatch--1.0.sql                         postgis_tiger_geocoder--2.1.0rc2--2.1.7.sql
fuzzystrmatch.control                          postgis_tiger_geocoder--2.1.0rc3--2.1.7.sql
fuzzystrmatch--unpackaged--1.0.sql             postgis_tiger_geocoder--2.1.1--2.1.7.sql
plpgsql--1.0.sql                               postgis_tiger_geocoder--2.1.2--2.1.7.sql
plpgsql.control                                postgis_tiger_geocoder--2.1.3--2.1.7.sql
plpgsql--unpackaged--1.0.sql                   postgis_tiger_geocoder--2.1.4--2.1.7.sql
postgis--2.0.0--2.1.7.sql                      postgis_tiger_geocoder--2.1.5--2.1.7.sql
postgis--2.0.1--2.1.7.sql                      postgis_tiger_geocoder--2.1.6--2.1.7.sql
postgis--2.0.2--2.1.7.sql                      postgis_tiger_geocoder--2.1.7--2.1.7next.sql
postgis--2.0.3--2.1.7.sql                      postgis_tiger_geocoder--2.1.7next--2.1.7.sql
postgis--2.0.4--2.1.7.sql                      postgis_tiger_geocoder--2.1.7.sql
postgis--2.0.5--2.1.7.sql                      postgis_tiger_geocoder.control
postgis--2.0.6--2.1.7.sql                      postgis_tiger_geocoder--unpackaged--2.1.7.sql
postgis--2.1.0--2.1.7.sql                      postgis_topology--2.0.0--2.1.7.sql
postgis--2.1.0rc1--2.1.7.sql                   postgis_topology--2.0.1--2.1.7.sql
postgis--2.1.0rc2--2.1.7.sql                   postgis_topology--2.0.2--2.1.7.sql
postgis--2.1.0rc3--2.1.7.sql                   postgis_topology--2.0.3--2.1.7.sql
postgis--2.1.1--2.1.7.sql                      postgis_topology--2.0.4--2.1.7.sql
postgis--2.1.2--2.1.7.sql                      postgis_topology--2.0.5--2.1.7.sql
postgis--2.1.3--2.1.7.sql                      postgis_topology--2.0.6--2.1.7.sql
postgis--2.1.4--2.1.7.sql                      postgis_topology--2.1.0--2.1.7.sql
postgis--2.1.5--2.1.7.sql                      postgis_topology--2.1.0rc1--2.1.7.sql
postgis--2.1.6--2.1.7.sql                      postgis_topology--2.1.0rc2--2.1.7.sql
postgis--2.1.7--2.1.7next.sql                  postgis_topology--2.1.0rc3--2.1.7.sql
postgis--2.1.7next--2.1.7.sql                  postgis_topology--2.1.1--2.1.7.sql
postgis--2.1.7.sql                             postgis_topology--2.1.2--2.1.7.sql
postgis.control                                postgis_topology--2.1.3--2.1.7.sql
postgis_tiger_geocoder--2.0.0--2.1.7.sql       postgis_topology--2.1.4--2.1.7.sql
postgis_tiger_geocoder--2.0.1--2.1.7.sql       postgis_topology--2.1.5--2.1.7.sql
postgis_tiger_geocoder--2.0.2--2.1.7.sql       postgis_topology--2.1.6--2.1.7.sql
postgis_tiger_geocoder--2.0.3--2.1.7.sql       postgis_topology--2.1.7--2.1.7next.sql
postgis_tiger_geocoder--2.0.4--2.1.7.sql       postgis_topology--2.1.7next--2.1.7.sql
postgis_tiger_geocoder--2.0.5--2.1.7.sql       postgis_topology--2.1.7.sql
postgis_tiger_geocoder--2.0.6--2.1.7.sql       postgis_topology.control
postgis_tiger_geocoder--2.1.0--2.1.7.sql       postgis_topology--unpackaged--2.1.7.sql
postgis_tiger_geocoder--2.1.0rc1--2.1.7.sql    postgis--unpackaged--2.1.7.sql

[root@cdh3 extension]#
[root@cdh3 extension]# cat fuzzystrmatch.control
# fuzzystrmatch extension
comment = 'determine similarities and distance between strings'
default_version = '1.0'
module_pathname = '$libdir/fuzzystrmatch'
relocatable = true

然后再创建:

postgres=# CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION
postgres=#
postgres=# CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION

postgres=#
postgres=# SELECT name, default_version,installed_version FROM pg_available_extensions WHERE name LIKE 'postgis%' ;
          name          | default_version | installed_version
------------------------+-----------------+-------------------
 postgis                | 2.1.7           | 2.1.7
 postgis_tiger_geocoder | 2.1.7           | 2.1.7
 postgis_topology       | 2.1.7           | 2.1.7
(3 rows)

这样就全部OK了。




































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

下一篇: postgis 地理数据
请登录后发表评论 登录
全部评论

注册时间:2009-05-13

  • 博文量
    94
  • 访问量
    351579