2012年9月3日 星期一

[記事] MapServer installation

屬於阿宅世界的技術文章,想看的再點開,切莫自誤 !



安裝 readline
# yum install readline-devel.i386 readline-devel.x86_64

安裝 PostgreSQL
# mkdir -p /home/psql/src
# cd /home/psql/src
# wget http://ftp.postgresql.org/pub/source/v9.1.5/postgresql-9.1.5.tar.gz
# tar zxvf postgresql-9.1.5.tar.gz
# cd postgresql-9.1.5
#./configure --prefix=/home/psql/
# make; make install

安裝GEOS
# mkdir -p /home/geos/src
# cd /home/geos/src/
# wget http://download.osgeo.org/geos/geos-3.3.5.tar.bz2
# bzip2 -d geos-3.3.5.tar.bz2
# tar xvf geos-3.3.5.tar
# cd geos-3.3.5
# ./configure --prefix=/home/geos/
# make; make install

安裝 proj
# mkdir -p /home/proj/src
# cd /home/proj/src
# wget http://download.osgeo.org/proj/proj-4.8.0.tar.gz
# tar zxvf proj-4.8.0.tar.gz
# cd proj-4.8.0
# ./configure --prefix=/home/proj
# make; make install

安裝 Xml2
# yum install libxml2-devel.i386 libxml2-devel.x86_64

安裝gcc-c++
# yum install gcc-c++

安裝GDAL
# mkdir -p /home/GDAL/src
# cd /home/GDAL/src
# wget http://download.osgeo.org/gdal/gdal-1.9.1.tar.gz
# tar zxvf gdal-1.9.1.tar.gz
# cd gdal-1.9.1
# ./configure --prefix=/home/GDAL --without-libtool

(不加 -without-libtool 會有
libtool: link: unable to infer tagged configuration
libtool: link: specify a tag with `--tag'
的錯誤訊息)

# make; make install

安裝 PostGIS
# mkdir -p /home/postgis/src
# cd /home/postgis/src
# wget http://postgis.refractions.net/download/postgis-2.0.1.tar.gz
# tar zxvf postgis-2.0.1.tar.gz
# cd postgis-2.0.1
# ./configure --prefix=/home/postgis/ --with-pgconfig=/home/psql/bin/pg_config --with-geosconfig=/home/geos/bin/geos-config --with-projdir=/home/proj/ --with-gdalconfig=/home/GDAL/bin/gdal-config
# make ; make install

安裝FreeType
# yum install freetype-devel.i386 freetype-devel.x86_64

安裝 AGG
# mkdir -p /home/AGG/src
# cd /home/AGG/src
# wget http://www.antigrain.com/agg-2.5.tar.gz
# tar zxvf agg-2.5.tar.gz
# cd agg-2.5
# sh ./autogen.sh
# ./configure --prefix=/home/AGG/

安裝 curl
# yum install curl-devel.i386 curl-devel.x86_64

安裝 libpng
# yum install libpng-devel.i386 libpng-devel.x86_64

安裝 giflib
# yum install giflib-devel.i386 giflib-devel.x86_64 giflib-utils.x86_64

安裝 libjpeg
# yum install libjpeg-devel.i386 libjpeg-devel.x86_64

安裝 GD
# yum install gd-devel.i386 gd-devel.x86_64

安裝MapServer
# mkdir -p /home/MapServer/src
# cd /home/MapServer/src
# wget http://download.osgeo.org/mapserver/mapserver-6.0.3.tar.gz
# tar zxvf mapserver-6.0.3.tar.gz
# cd mapserver-6.0.3
# ./configure --prefix=/home/MapServer/ --with-ogr=/home/GDAL/bin/gdal-config --with-gdal=/home/GDAL/bin/gdal-config --with-httpd=/usr/sbin/httpd --with-wfsclient --with-wmsclient --enable-debug --with-curl-config=/usr/bin/curl-config --with-proj=/home/proj/ --with-tiff --with-gd --with-jpeg --with-freetype --with-threads --with-wcs --with-postgis=/home/psql/bin/pg_config --with-libiconv --with-xml2-config=/usr/bin/xml2-config --with-agg=/home/AGG/src/agg-2.5
# make

將 mapserv 複製到你的web server cgi-bin 目錄下
# cp mapserv /var/www/cgi-bin/

設定library path
# vi /etc/ld.so.conf.d/psql.conf
/home/psql/lib

# vi /etc/ld.so.conf.d/gis.conf
/home/proj/lib
/home/GDAL/lib


#ldconfig

測試

http://YOUR_IP/cgi-bin/mapserv
如果出現No query information to decode. QUERY_STRING is set, but empty.

就成功了。

Debug
錯誤訊息都會出現在你的Web Server的error log 裡, Eg. /etc/httpd/logs/error_log


Ref :
http://mapserver.org/installation/unix.html

0 意見:

張貼留言