Postgresql 8.4 + PostGIS 1.40 の環境をUbuntu9.10に構築メモ。
Postgresql 8.4は以前インストールしたものをそのまま利用中。
まだ古いPostGISしか入っていないので、手動でインストールすることにした。
PROJ.4
PROJ.4 - Trac http://trac.osgeo.org/proj/
proj-4.7.0.tar.gzをダウンロード。
解凍し以下を実行。
# ./configure
# make
# make check
# make install
GEOS
GEOS - Trac http://trac.osgeo.org/geos/
geos-3.2.0rc1.tar.bz2をダウンロード。
解凍しいつもの手順を実行。
# ./configure
# make
# make check
# make install
一応メモ
Libraries have been installed in:
/usr/local/libIf you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
PostGIS 1.40
PostGIS : Home
http://postgis.refractions.net/
上記の二つのライブラリをインストールした後にPostGISライブラリのインストールを行う。
PostGISは公式サイトからダウンロード。
postgresアカウントからインストール作業を行うので注意。
$ su postgres
$ ./configure --with-pgconfigure=/usr/local/pgsql/bin/pg_cofig
(pg_configが見つからないと言われた時の場合、インストールした環境依存なのでlocate pg_configとかで探すといいかも)
postgreアカウントにpathやライブラリを設定していない場合は/home/postgres/.bashrcのファイルの末尾に以下を追加。
これを忘れていたので、make checkに失敗してはまった。
export PATH=/usr/local/pgsql/bin:$PATH
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
./configureのオプションについて
CONFIGURATION
- -
To configure PostGIS, run:
./configureThe results of the configuration can be easily seen within the
postgis_config.h file.If pg_config can't be found in your $PATH configure will complain
and refuse to proceed. You can specify it using the
- with-pgconfig=/path/to/pg_config flag.
If PROJ4 has been installed (but cannot be found), configure will
complain and refuse to proceed. You can specify an alternative
installation directory using the --with-projdir=DIR option.If GEOS has been installed (but cannot be found), configure will
complain and refuse to proceed. You can specify an alternative
geos-config file using the --with-geosconfig=/path/to/geos-config
option.See ./configure --help for more options.
ちゃんとPROJ.4やGEOSをインストールして環境変数を追加していれば特に.configureにオプションはいらないはず。
成功すると以下のようなメッセージが出力される。
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/bin/geos-config
GEOS version: 3.2
PostgreSQL config: /usr/local/pgsql/bin/pg_config
PostgreSQL version: 8.4
PROJ4 version: 47
PostGIS debug level: 0-------- Documentation Generation --------
xsltproc: /usr/bin/xsltproc
xsl style sheets:
dblatex:
convert: /usr/bin/convert
そしてpostgresユーザのままmakeを実行。
ただし、ファイルやフォルダの所有者がpostgresじゃないとうまくいかないので(そりゃそうだ)注意かも。
chown -R postgres:postgres ./postgis-1.4.0と実行し所有者を変更。
$ make
PostGIS was built successfully. Ready to install.
と表示されれば成功
make checkで失敗した。(解決済み)
cp ../postgis/postgis.sql .
Creating spatial db postgis_reg
TMPDIR is /tmp/pgis_reg_8361
PATH is ":/usr/local/pgsql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"PostgreSQL 8.4.0 on i686-pc-linux-gnu, compiled by GCC gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3, 32-bit
Postgis 1.4.0 - 2009-11-20 09:59:59
GEOS: 3.2.0-CAPI-1.6.0
PROJ: Rel. 4.7.1, 23 September 2009Running tests
loader/Point....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/PointM....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/PointZ....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/MultiPoint....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/MultiPointM....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/MultiPointZ....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/Arc....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/ArcM....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/ArcZ..... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/Polygon....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/PolygonM....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
loader/PolygonZ....... failed (dumping loaded table: /tmp/pgis_reg_8361/dumper.err)
regress. ok
regress_index. ok
regress_index_nulls. ok
lwgeom_regress. ok
regress_lrs. ok
removepoint. ok
setpoint. ok
simplify. ok
snaptogrid. ok
affine. ok
wkt. ok
measures. ok
long_xact. ok
ctors. ok
sql-mm-serialize. ok
sql-mm-circularstring. ok
sql-mm-compoundcurve. ok
sql-mm-curvepoly. ok
sql-mm-general. ok
sql-mm-multicurve. ok
sql-mm-multisurface. ok
geojson. ok
gml. ok
svg. ok
kml. ok
regress_ogc. ok
regress_bdpoly. ok
regress_proj. ok
regress_ogc_cover. ok
regress_ogc_prep. okRun tests: 42
Failed: 12
エラーの原因はLD_LIBRARY_PATHを~/.bashrcに書くのを忘れていたからだった。
/home/postgres/.bashrcのファイルの末尾に以下を追加。
export PATH=/usr/local/pgsql/bin:$PATH
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
再度make checkを実行する。
$ make check
cp ../postgis/postgis.sql .
Creating spatial db postgis_reg
TMPDIR is /tmp/pgis_reg_10002
PATH is ":/usr/local/pgsql/bin:/usr/local/pgsql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"PostgreSQL 8.4.0 on i686-pc-linux-gnu, compiled by GCC gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3, 32-bit
Postgis 1.4.0 - 2009-11-20 09:59:59
GEOS: 3.2.0-CAPI-1.6.0
PROJ: Rel. 4.7.1, 23 September 2009Running tests
loader/Point.............. ok
loader/PointM.............. ok
loader/PointZ.............. ok
loader/MultiPoint.............. ok
loader/MultiPointM.............. ok
loader/MultiPointZ.............. ok
loader/Arc.............. ok
loader/ArcM.............. ok
loader/ArcZ.......... ok
loader/Polygon.............. ok
loader/PolygonM.............. ok
loader/PolygonZ.............. ok
regress. ok
regress_index. ok
regress_index_nulls. ok
lwgeom_regress. ok
regress_lrs. ok
removepoint. ok
setpoint. ok
simplify. ok
snaptogrid. ok
affine. ok
wkt. ok
measures. ok
long_xact. ok
ctors. ok
sql-mm-serialize. ok
sql-mm-circularstring. ok
sql-mm-compoundcurve. ok
sql-mm-curvepoly. ok
sql-mm-general. ok
sql-mm-multicurve. ok
sql-mm-multisurface. ok
geojson. ok
gml. ok
svg. ok
kml. ok
regress_ogc. ok
regress_bdpoly. ok
regress_proj. ok
regress_ogc_cover. ok
regress_ogc_prep. okRun tests: 42
Failed: 0
O.K.