Installing Mapserver on Ubuntu

 

Created on: 8/30/17
Last update: 6/7/19

Installing from Package

Install required packages:

sudo apt-get install apache2 apache2-bin apache2-utils cgi-mapserver mapserver-bin mapserver-doc libmapscript-perl python-mapscript ruby-mapscript

Check installation:

mapserv -v

Enable cgi and fastcgi:

sudo a2enmod cgi fcgid

Configure /etc/apache2/sites-available/000-default.conf and add:

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin/">
    AllowOverride All
    Options +ExecCGI -MultiViews +FollowSymLinks
    AddHandler fcgid-script .fcgi
    Require all granted
</Directory>

Restart apache:

sudo service apache2 restart

Test the link (http://localhost/cgi-bin/mapserv?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities)[http://localhost/cgi-bin/mapserv?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities] and check the retuen message: msCGILoadMap(): Web application error. CGI variable "map" is not set.

Installing from source

Download MapServer

The latest release of Mapserver can be downloaded at http://download.osgeo.org/mapserver/.

Take Mapserver 7.0.6 as example:

wget http://download.osgeo.org/mapserver/mapserver-7.0.6.tar.gz
tar -xzf mapserver-7.0.6.tar.gz

Required External Libraries

Cmake

apt-get install cmake

libpng

Description: libpng should be on your system by default. Versions back to 1.2.7 should work.

apt-get install libpng-dev

freetype

Description: Version 2.x or above is required.

sudo apt install libfreetype6

libjpeg

Description: libjpeg allows MapServer to render images in JPEG format. A sufficient version should be installed by default on your system (probably version 6b from 1998).

apt-get install libjpeg-dev

zlib

Description: Zlib should be on your system by default. Though not used directly by mapserver, it’s a mandatory dependency of libpng.

[to be continued]

Reference

Official

  1. Install mapserver on ubuntu 18.04 from official repository
  2. Compiling on Unix

Blogs and Posts

  1. How to install Mapserver on Ubuntu?
  2. https://goworldwind.org/mapserver-and-data-installation/