debian 安装mapserver

本文介绍在Debian系统中安装MapServer的过程,包括安装Apache、MapServer及相关组件,配置Apache使其支持MapServer,以及如何验证安装是否成功。

debian 安装mapserver

1.apt-get install apache2
2.apt-get install cgi-mapserver mapserver-bin perl-mapscript
3.查看并测试是否安装成功
    1.cd /usr/lib/cgi-bin
    2.mapserv -v
    出现如下内容:
    MapServer version 5.6.5 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

    表示mapserv安装成功。
4.配置apache


httpd.conf中添加配置如下内容:
<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/usr/lib/cgi-bin/"
    ScriptAlias /fcgi-bin/ "/usr/lib/cgi-bin/"

    ##
    ## Alias for MapServer tmp directory
    ##


</IfModule>

5.重启apache,并测试

    1.重启
    apachectl restart
    2.测试
    http://192.168.1.101/cgi-bin/mapserv
    出现如下内容:
    No query information to decode. QUERY_STRING is set, but empty.
    表示配置成功。
6.进一步测试
        1.wget http://www.duif.net/postgis/world.map
        2.测试得到此图层的capabilities
        
        http://192.168.1.101/cgi-bin/mapserv?map=/usr/lib/cgi-bin/world.map&request=getcapabilities&service=wms

7.安装的默认目录及下载目录:
/usr/share/doc/cgi-mapserver
/usr/share/lintian/overrides/cgi-mapserver
/var/cache/apt/archives/cgi-mapserver_5.6.5-2+squeeze2_amd64.deb
/var/lib/dpkg/info/cgi-mapserver.list
/var/lib/dpkg/info/cgi-mapserver.md5sums


        
        
参考网址:
http://trac.osgeo.org/mapserver/wiki/DebianLinux
http://www.duif.net/postgis/
### 安装 OpenStreetMap 的逐步指南 #### 准备工作 为了成功安装并运行 OpenStreetMap (OSM),需要准备一些基础环境。通常情况下,这涉及到服务器端软件的配置以及数据库的选择。常见的做法是在 Linux 发行版上部署 OSM 服务[^1]。 #### 安装依赖项 在开始之前,确保操作系统是最新的,并安装必要的依赖库。对于基于 Debian/Ubuntu 的系统来说,可以通过以下命令来更新包列表并安装所需工具: ```bash sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install build-essential libxml2-dev libxslt1-dev python3-pip postgresql postgresql-contrib postgis osmosis wget git unzip curl apache2 php php-pgsql php-gd gdal-bin proj-bin libproj-dev ruby-full bundler nodejs npm yarn ``` #### 设置 PostgreSQL 和 PostGIS OpenStreetMap 数据存储于支持空间扩展功能的 SQL 数据库中,PostgreSQL 结合 PostGIS 是推荐组合之一。创建专用用户账户和地理空间启用的地图数据表如下所示: ```bash sudo -u postgres createuser -s gis_user createdb -E UTF8 -T template0 --locale=en_US.utf8 gis_db psql -c "CREATE EXTENSION postgis;" -d gis_db psql -c "CREATE EXTENSION hstore;" -d gis_db ``` #### 下载地图数据 获取特定区域内的最新 OSM XML 文件或 PBF 格式的压缩文件。可以从 Geofabrik 或 BBBike 等网站下载适合大小的数据集。使用 `osm2pgsql` 工具导入到刚才建立好的数据库里去: ```bash wget http://download.geofabrik.de/europe/great-britain-latest.osm.pbf osm2pgsql --slim -d gis_db great-britain-latest.osm.pbf ``` #### 配置 Web 映射前端 最后一步是搭建可视化界面以便查看渲染后的地图瓦片图像。可以考虑采用 Leaflet.js 这样的 JavaScript 库配合 Apache HTTP Server 提供静态网页访问入口;或者更进一步集成 Maps Marker Pro 插件实现高级交互特性[^2]。 请注意上述过程仅作为一般指导方针,在实际操作过程中可能遇到不同版本兼容性问题或其他特殊情况,请参照官方文档调整相应参数设置。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值