ubuntu源码安装postgresql

整个安装过程google无数遍,最后终于搭建完了。
具体步骤,以及遇到error解决方案。

1、wget http://ftp.postgresql.org/pub/source/v9.1.4/postgresql-9.1.4.tar.gzmkdir /usr/local/pgsql


tar -zxvf postgresql-9.1.4.tar.gz


./configure -prefix=/usr/local/pgsql --without-readline


make
make install


2、mkdir /usr/local/geos
wget http://download.osgeo.org/geos/geos-3.3.5.tar.bz2


tar jxf geos-3.3.5.tar.bz2

cd geos-3.3.5

./configure -prefix=/usr/local/geos

make

make install


error:

source='IndexedPointInAreaLocator.cpp' object='IndexedPointInAreaLocator.lo' libtool=yes \

DEPDIR=.deps depmode=none /bin/bash ../../../depcomp \

/bin/bash ../../../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 990: g++: command not found

make[4]: *** [IndexedPointInAreaLocator.lo] Error 1

make[4]: Leaving directory `/root/software/geos-3.3.5/src/algorithm/locate'

make[3]: *** [all-recursive] Error 1

make[3]: Leaving directory `/root/software/geos-3.3.5/src/algorithm/locate'

make[2]: *** [all-recursive] Error 1

make[2]: Leaving directory `/root/software/geos-3.3.5/src/algorithm'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/root/software/geos-3.3.5/src'

make: *** [all-recursive] Error 1


解决:

apt-get install g++

重新configure

make

make install


3、mkdir /usr/local/proj4

wget http://download.osgeo.org/proj/proj-4.8.0.tar.gz


tar zxf proj-4.8.0.tar.gz


cd proj-4.8.0

./configure –prefix=/usr/local/proj4
make
make install


4、mkdir /usr/local/postgis
wget http://postgis.refractions.net/download/postgis-2.0.1.tar.gz


tar zxf postgis-2.0.1.tar.gz

cd postgis-2.0.1

./configure -prefix=/usr/local/postgis --with-pgsql=/usr/local/pgsql/bin/pg_config --with-proj=/usr/local/proj4 --with-geos=/usr/local/geos/bin/geos-config


error:
configure: error: could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.


解决:

./configure -prefix=/usr/local/postgis --with-pgsql=/usr/local/pgsql/bin/pg_config --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-proj=/usr/local/proj4 --with-geos=/usr/local/geos/bin/geos-config


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.


解决:

apt-get install libxml2

apt-get install libxml2-dev


./configure -prefix=/usr/local/postgis --with-pgsql=/usr/local/pgsql/bin/pg_config --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-proj=/usr/local/proj4 --with-geos=/usr/local/geos/bin/geos-config


error:

configure: error: could not find geos-config within the current path. You may need to try re-running configure with a --with-geosconfig parameter.


解决:

./configure -prefix=/usr/local/postgis --with-pgsql=/usr/local/pgsql/bin/pg_config --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-proj=/usr/local/proj4 --with-geos=/usr/local/geos/bin/geos-config --with-geosconfig=/usr/local/geos/bin/geos-config


error:

configure: error: could not find proj_api.h - you may need to specify the directory of a PROJ.4 installation using --with-projdir


解决 :

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


error:

configure: error: gdal-config not found. Use --without-raster or try --with-gdalconfig=<path to gdal-config>


解决:

apt-cache search GDAL

apt-get install libgdal1-dev


configure: WARNING: unrecognized options: --with-pgsql, --with-proj, --with-geos






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 -traditional-cpp -P

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

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

GEOS version: 3.3.5

GDAL config: /usr/bin/gdal-config

GDAL version: 1.6.3

PostgreSQL config: /usr/local/pgsql/bin/pg_config

PostgreSQL version: PostgreSQL 9.1.4

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


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

xsltproc:

xsl style sheets:

dblatex:

convert:

mathml2.dtd: http://www.w3.org/Math/DTD/mathml2/mathml2.dtd





final config:

./configure -prefix=/usr/local/postgis --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-geosconfig=/usr/local/geos/bin/geos-config --with-projdir=/usr/local/proj4


make

make install


------------------------------------------------------------------------

WARNING: You have set the --prefix to '/usr/local/postgis'. But we mostly

ignore the --prefix. For your info, using the values determined from

/usr/local/pgsql/bin/pg_config we will be installing:

* postgis shared library in /usr/local/pgsql/lib

* postgis SQL files in /usr/local/pgsql/share/contrib/postgis-2.0

* postgis executables in /usr/local/pgsql/bin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值