end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

install postgres 11.2 & postgis 2.5 & mapserver 7.2 (2019年版)

install postgres 9.6 & postgis 2.3 & mapserver & mapserver 7.0 - end0tknr's kipple - 新web写経開発

国土交通省にあるGISデータをPostGISへインポート(2017年版) - end0tknr's kipple - 新web写経開発

上記2エントリの2019年版。

面倒なので、前回との差異のみを以下に記載します。

PostGIS 2.5 は、PostgreSQL 11.2 にもinstall OK

https://postgis.net/docs/manual-2.5/postgis_installation.html の「Required」に「PostgreSQL 9.4 or higher.」と記載されています。

「ver.11.2って上げ過ぎかな?」とも思いましたが、 結果的に問題なく、PostGIS 2.5をinstallできました。

postgresのcreatelangコマンドが削除されていました

前回のエントリににて

$ /usr/local/pgsql/bin/createlang -U postgres plpgsql gis_test

を実行していますが、postgres 11.2ではcreatelangがありませんでした。

$ /usr/local/pgsql/bin/psql -U postgres gis_test
psql> CREATE LANGUAGE plpgsql;
ERROR:  language "plpgsql" already exists

の手順で操作すればよいようです。 ただし、この「CREATE LANGUAGE plpgsql」はそもそもPostGISのinstallでは 不要な操作だったようです。

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

$ /usr/local/pgsql/bin/psql -U postgres -d gis_test \
   -f /usr/local/pgsql/share/contrib/postgis-2.5/postgis.sql
BEGIN
SET
DO
CREATE FUNCTION
psql:/usr/local/pgsql/share/contrib/postgis-2.5/postgis.sql:94: ERROR:  could not load library "/usr/local/pgsql/lib/postgis-2.5.so": libgeos_c.so.1: cannot open shared object file: No such file or directory
   :

のようなエラーが発生。

$ sudo vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib

$ sudo ldconfig

のように「/usr/local/lib」を追加し、一旦?は回避しました。

mapserverno cmakeコマンド

以下のように実行しました。 この後の 国土交通省にあるGISデータをPostGISへインポートやPNGファイル作成も問題なく動作しています。

$ cmake -DCMAKE_PREFIX_PATH=/usr/local/pgsql \
>       -DWITH_PROTOBUFC=0 \
>       -DWITH_GIF=0 \
>       ..
-- * Summary of configured options for this build
--  * Mandatory components
--   * png: /usr/local/lib/libpng.so
--   * jpeg: /usr/local/lib/libjpeg.so
--   * freetype: /usr/local/lib/libfreetype.so
--  * Optional components
--   * GDAL: /usr/local/lib/libgdal.so
--   * OGR: /usr/local/lib/libgdal.so
--   * GIF: disabled
--   * MYSQL: disabled
--   * FRIBIDI: /usr/local/lib/libfribidi.so
--   * HARFBUZZ: /usr/lib64/libharfbuzz.so
--   * GIF: disabled
--   * CAIRO: /usr/lib64/libcairo.so
--   * SVGCAIRO: disabled
--   * RSVG: disabled
--   * CURL: disabled
--   * PROJ: /usr/local/lib/libproj.so
--   * PIXMAN: disabled
--   * LIBXML2: /usr/lib64/libxml2.so
--   * POSTGIS: /usr/local/pgsql/lib/libpq.so
--   * GEOS: /usr/local/lib/libgeos_c.so
--   * FastCGI: /usr/local/lib/libfcgi.so
--   * PROTOBUFC: disabled
--   * Oracle Spatial: disabled
--   * Exempi XMP: disabled
--  * Optional features
--   * WMS SERVER: ENABLED
--   * WFS SERVER: ENABLED
--   * WCS SERVER: ENABLED
--   * SOS SERVER: disabled
--   * WMS CLIENT: disabled
--   * WFS CLIENT: disabled
--   * ICONV: ENABLED
--   * Thread-safety support: disabled
--   * KML output: disabled
--   * Z+M point coordinate support: disabled
--   * XML Mapfile support: disabled
--  * Mapscripts
--   * Python: disabled
--   * PHP: disabled
--   * PERL: disabled
--   * RUBY: disabled
--   * JAVA: disabled
--   * C#: disabled
--   * V8 Javascript: disabled
--   * Apache Module (Experimental): disabled
-- 
-- Will install files to /usr/local
-- Will install libraries to /usr/local/lib
-- Configuring done
-- Generating done
-- Build files have been written to: /home/end0tknr/tmp/mapserver-7.2.2/build