MapServer linux上服务安装
目录
MapServer linux上服务安装
新建mapserver用户
安装相关依赖
-
gcc-c++
查询gcc-c++是否安装:rpm -qa | grep gcc-c++
安装gcc-c++:
yum -y install gcc-c++
-
gcc cmake curl
安装gcc cmake curl:yum -y install gcc cmake curl curl-devel
部分lib已安装,不会重复安装。
- 安装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
- 安装cairo 2D图形库:
yum -y install cairo cairo-devel
- PostGis安装
需要先安装postgresql数据库参考:
PostGIS安装参考
- sqlite 安装
yum -y install sqlite sqlite-devel
- httpd web server 安装
yum -y install httpd httpd-devel fcgi fcgi-devel mod_fcgid
- 安装GIS相关库
yum -y install gdal gdal-devel geos geos-devel proj proj-devel
- 安装SWIG
yum -y install swig swig-devel
- 安装python
yum -y install python python-devel
- MapCache安装
获取mapcache:wget http://download.osgeo.org/mapservehttp://download.osgeo.org/mapserver/mapcache-1.4.1.tar.gzr/mapcache-1.4.1.tar.gz
tar -xvf mapcache-1.4.1.tar.gz
...
cd mapcache-1.4.1
mkdir build
cd build
cmake ..
make
make install
- MapServer安装
下载MapServer 7.0.1wget 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
配置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/
-
拷贝依赖
-
创建图片缓存目录
·
[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
- 拷贝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
转载自:https://blog.csdn.net/weixin_33759269/article/details/87625912