ubuntu源码安装postgresql(问题解决)转载

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

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


tar -zxvfpostgresql-9.1.4.tar.gz 



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


make 
make install 




2、mkdir /usr/local/geos 
wgethttp://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.loIndexedPointInAreaLocator.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 -cIndexedPointInAreaLocator.cpp  -o.libs/IndexedPointInAreaLocator.o 

../../../libtool: line 990: g++: command notfound 

make[4]: *** [IndexedPointInAreaLocator.lo] Error1 

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

make[3]: *** [all-recursive] Error1 

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

make[2]: *** [all-recursive] Error1 

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

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

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

make: *** [all-recursive] Error1 



解决: 

apt-get install g++ 

重新configure 

make 

make install 



3、mkdir /usr/local/proj4 

wgethttp://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 
wgethttp://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-pgconfigparameter. 




解决: 

./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 withinthe 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 currentpath. 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 tospecify 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 ortry --with-gdalconfig= 



解决: 

apt-cache search GDAL 

apt-get install libgdal1-dev 







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





Java代码    收藏代码
  1. PostGIS is now configured for x86_64-unknown-linux-gnu  
  2.   
  3.   
  4.   
  5. -------------- Compiler Info -------------  
  6.   
  7.  C compiler:           gcc -g -O2  
  8.   
  9.  C++ compiler:         g++ -g -O2  
  10.   
  11.  SQL preprocessor:     /usr/bin/cpp -traditional-cpp -P  
  12.   
  13. ------------- Dependencies --------------  
  14.   
  15.  GEOS config:          /usr/local/geos/bin/geos-config  
  16.   
  17.  GEOS version:         3.3.5  
  18.   
  19.  GDAL config:          /usr/bin/gdal-config  
  20.   
  21.  GDAL version:         1.6.3  
  22.   
  23.  PostgreSQL config:    /usr/local/pgsql/bin/pg_config  
  24.   
  25.  PostgreSQL version:   PostgreSQL 9.1.4  
  26.   
  27.  PROJ4 version:        48  
  28.   
  29.  Libxml2 config:       /usr/bin/xml2-config  
  30.   
  31.  Libxml2 version:      2.7.6  
  32.   
  33.  JSON-C support:       yes  
  34.   
  35.  PostGIS debug level:  0  
  36.   
  37.  Perl:                 /usr/bin/perl  
  38.   
  39.   
  40.   
  41. --------------- Extensions ---------------  
  42.   
  43.  PostGIS Raster:       enabled  
  44.   
  45.  PostGIS Topology:     enabled  
  46.   
  47.   
  48.   
  49. -------- Documentation Generation --------  
  50.   
  51.  xsltproc:              
  52.   
  53.  xsl style sheets:      
  54.   
  55.  dblatex:               
  56.   
  57.  convert:               
  58.   
  59.  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 



------------------------------------------------------------------------ 
Java代码    收藏代码
  1. WARNING: You have set the --prefix to '/usr/local/postgis'. But we mostly     
  2.   
  3.  ignore the --prefix. For your info, using the values determined from  
  4.   
  5.  /usr/local/pgsql/bin/pg_config we will be installing:    
  6.   
  7.    * postgis shared library in /usr/local/pgsql/lib  
  8.   
  9.    * postgis SQL files in /usr/local/pgsql/share/contrib/postgis-2.0  
  10.   
  11.    * postgis executables in /usr/local/pgsql/bin  

你可能感兴趣的:(ubuntu源码安装postgresql(问题解决)转载)