MapServer linux上服务安装

MapServer linux上服务安装


新建mapserver用户

2279108-ae1e1990a18ef617.png
新建map server用户//密码123456

安装相关依赖

  • gcc-c++
    查询gcc-c++是否安装:
    rpm -qa | grep gcc-c++

    2279108-dea1fbd747a06af2.png
    查询gcc-c++是否安装

    安装gcc-c++:
    yum -y install gcc-c++

    2279108-251c61c2a8631f9b.png
    安装gcc-c++

  • gcc cmake curl
    安装gcc cmake curl:
    yum -y install gcc cmake curl curl-devel
    部分lib已安装,不会重复安装。

2279108-a3f451a57a131900.png
安装gcc cmake curl
  • 安装cgi相关拓展依赖:
yum -y install libpng libpng-devel freetypegd gd-devel zlib zlib-devel 
giflib giflib-devel readline readline-devel libxml2 libxml2-devel 
libtiff libtiff-devel libjpeg libjpeg-devel libgeotiff 
2279108-acd6233dc1f73d42.png
cgi依赖安装part-1
2279108-8e58118604e94692.png
cgi依赖安装part-2
2279108-e328e00be7548244.png
cgi依赖安装part-3
  • 安装cairo 2D图形库:
    yum -y install cairo cairo-devel
2279108-aea826bcb5a80469.png
cairo安装-part1
2279108-98161b73061217cb.png
cairo安装-part2
  • PostGis安装
    需要先安装postgresql数据库参考:
    PostGIS安装参考
2279108-fe788343b714f06e.png
postgis安装
  • sqlite 安装
    yum -y install sqlite sqlite-devel
2279108-81f2e5a1659e2837.png
sqlite安装-part1
2279108-75f064c65dc1e690.png
sqlite安装-part2
  • httpd web server 安装
yum -y install httpd httpd-devel fcgi fcgi-devel mod_fcgid
2279108-98a2f89f7e041c49.png
webServer安装-part1
2279108-657fa1fe44806169.png
WebServer安装-part2
  • 安装GIS相关库
yum -y install gdal gdal-devel geos geos-devel proj proj-devel
2279108-6f3a2a68311362a0.png
按章GIS相关lib-part1
2279108-1f877532d0373cb4.png
安装GIS相关lib-part2
  • 安装SWIG
    yum -y install swig swig-devel
2279108-7f8ce2baa9341460.png
SWIG安装
  • 安装python
    yum -y install python python-devel
2279108-b9fab18c85b0bee5.png
python安装-part1
2279108-0c0ecb3e591c92c1.png
python安装-part2
  • MapCache安装
    获取mapcache:
    wget http://download.osgeo.org/mapservehttp://download.osgeo.org/mapserver/mapcache-1.4.1.tar.gzr/mapcache-1.4.1.tar.gz
2279108-d279c2a3cf991aad.png
下载MapCache 以及MapServer安装源代码
tar -xvf  mapcache-1.4.1.tar.gz
...
cd  mapcache-1.4.1
mkdir build 
cd build 
cmake ..
make 
make install
2279108-f578a31c13d4eb42.png
mapcache安装-part1
2279108-e03d35071a0f72a1.png
mapcache安装-part2
2279108-8497046596f3e450.png
mapcache安装-part2
2279108-86c5e8696b2e8f60.png
mapcache安装-part3
2279108-c11cbbbff837ff75.png
mapcache安装-part4
  • MapServer安装
    下载MapServer 7.0.1
    wget http://download.osgeo.org/mapserver/mapserver-7.0.1.tar.gz
    安装:
tar -xvf mapserver-7.0.1.tar.gz
cd mapserver-7.0.1
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt -DCMAKE_PREFIX_PATH=/usr/pgsql-9.6:/usr/share:/usr/lib64:/usr/lib64/python2.6:/usr/local:/opt -DWITH_CLIENT_WFS=ON  -DWITH_CLIENT_WMS=ON  -DWITH_CURL=ON  -DWITH_SOS=ON  -DWITH_PHP=OFF  -DWITH_PERL=ON  -DWITH_RUBY=OFF  -DWITH_JAVA=OFF  -DWITH_CSHARP=OFF  -DWITH_PYTHON=ON  -DWITH_SVGCAIRO=OFF  -DWITH_ORACLESPATIAL=OFF  -DWITH_MSSQL2008=OFF -DWITH_FRIBIDI=0 -DWITH_LIBXML2=1 -DWITH_HARFBUZZ=0 -DWITHCAIRO=0  -DWITH_POSTGIS=0 -DWITH_CAIRO=0  ../>../configure.out.txt
2279108-9f625d77204f91c2.png
MapServer cmake
2279108-6d02a95426df199c.png
MapServer安装-part1
2279108-3ba08e7b1d779ede.png
MapServer安装-part2
2279108-7d1ba50bd2dec047.png
MapServer安装-part3
2279108-f11ebd5d2c43e24c.png
MapServer安装-part4
2279108-0d5bca43a75630f8.png
MapServer安装-part5
2279108-439cf821838cc907.png
MapServer安装-part6
2279108-58160c4db23e364f.png
MapServer安装-part7
2279108-14474cfbb5f3b9f9.png
MapServer安装-part8
2279108-b94c8593b82bc06e.png
MapServer安装-part9
2279108-e06947db484308ac.png
MapServer安装-part10
2279108-489e95f959e39de7.png
MapServer安装-part11

配置Web service CGI

拷贝libmapcache.so 与 libmapcache.so.1

[root@localhost lib64]# cp /usr/local/lib/libmapcache.so
libmapcache.so        libmapcache.so.1      libmapcache.so.1.4.1  
[root@localhost lib64]# cp /usr/local/lib/libmapcache.so /usr/lib64/
[root@localhost lib64]# cp /usr/local/lib/libmapcache.so.1 /usr/lib64/
  • 拷贝依赖

    2279108-dd683bad6d1cbc9e.png
    拷贝libmapcache
  • 创建图片缓存目录
    ·

[root@localhost mapserver]# mkdir -p /home/mapserver/ms_data/cache
[root@localhost mapserver]# cp /usr/local/package/mapcache-1.4.1/mapcache.xml /home/mapserver/ms_data/cache/
  • 配置httpd module
vi /etc/httpd/conf/httpd.conf
2279108-44d96207616dc16a.png
配置httpd module
  • 拷贝map server依赖
[root@localhost cache]# cd /opt/lib/
[root@localhost lib]# ll
总用量 4128
lrwxrwxrwx. 1 root root      16 10月 17 18:16 libmapcache.so -> libmapcache.so.1
lrwxrwxrwx. 1 root root      20 10月 17 18:16 libmapcache.so.1 -> libmapcache.so.1.4.1
-rwxr-xr-x. 1 root root  421474 10月 17 18:02 libmapcache.so.1.4.1
lrwxrwxrwx. 1 root root      17 10月 17 18:21 libmapserver.so -> libmapserver.so.2
lrwxrwxrwx. 1 root root      21 10月 17 18:21 libmapserver.so.2 -> libmapserver.so.7.0.1
-rwxr-xr-x. 1 root root 3802833 10月 17 18:21 libmapserver.so.7.0.1
[root@localhost lib]# cp /opt/lib/libmapserver.so /usr/local/lib/
[root@localhost lib]# cp /opt/lib/libmapserver.so.2 /usr/local/lib/
[root@localhost lib]# cp /opt/lib/libmapserver.so.7.0.1 /usr/local/lib/
[root@localhost lib]# cd /usr/local/lib
[root@localhost lib]# ll | grep libmap
lrwxrwxrwx. 1 root root      16 10月 17 18:02 libmapcache.so -> libmapcache.so.1
lrwxrwxrwx. 1 root root      20 10月 17 18:02 libmapcache.so.1 -> libmapcache.so.1.4.1
-rwxr-xr-x. 1 root root  421474 10月 17 18:17 libmapcache.so.1.4.1
-rwxr-xr-x. 1 root root 3802833 10月 17 18:51 libmapserver.so
-rwxr-xr-x. 1 root root 3802833 10月 17 18:51 libmapserver.so.2
-rwxr-xr-x. 1 root root 3802833 10月 17 18:51 libmapserver.so.7.0.1
[root@localhost lib]# cp /usr/local/package/mapserver-7.0.1/build/mapserv /var/www/cgi-bin/
[root@localhost lib]# cd /var/www/cgi-bin/
[root@localhost cgi-bin]# ll
总用量 16
-rwxr-xr-x. 1 root root 13630 10月 17 18:53 mapserv

You may also like...