| 1 | = MapServer on Debian GNU/Linux = |
| 2 | |
| 3 | == MapServer Debian Package == |
| 4 | !MapServer 4.0.1 is installable directly as a debian package via apt-get on Debian Woody (and above). The package can be installed by adding the following lines to your /etc/apt/sources.list file: |
| 5 | |
| 6 | deb http://www.paulbaker.net/debian stable main |
| 7 | deb-src http://www.paulbaker.net/debian stable main |
| 8 | |
| 9 | !MapServer is available as three packages: |
| 10 | |
| 11 | * mapserver-cgi - The mapserv cgi program installed in /usr/lib/cgi-bin |
| 12 | * mapserver-utils - The other miscellaneous programs compiled as part of MapServer. |
| 13 | * libmapscript-perl - Mapscript/Perl? module. |
| 14 | |
| 15 | To install them, issue into a root shell: |
| 16 | |
| 17 | apt-get install mapserver-cgi mapserver-utils libmapscript-perl |
| 18 | |
| 19 | or use your favorite package manager (aptitude, synaptic...). |
| 20 | |
| 21 | Running /usr/lib/cgi-bin/mapserv -v should return the following output: |
| 22 | |
| 23 | MapServer version 4.0.1 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP SUPPORTS=PROJ |
| 24 | SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_CLIENT |
| 25 | INPUT=TIFF INPUT=EPPL7 INPUT=JPEG INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE |
| 26 | |
| 27 | As of 2004/07/21, a vanilla Debian Sarge installation will cause mapserv to fail with: |
| 28 | |
| 29 | mapserv: relocation error: /usr/lib/libgdal.so.1: undefined symbol: _ZTI13XMLEntityDecl? |
| 30 | |
| 31 | because of changes in the current libgdal1_1.2.0-1 package. The solution is to force the installation of the package in Paul's repository. Check the current version: |
| 32 | |
| 33 | http://www.paulbaker.net/debian/dists/stable/main/binary-i386/gdal/ |
| 34 | |
| 35 | feed it to apt-get, and flag it with hold so its not upgraded: |
| 36 | |
| 37 | apt-get install libgdal1=1.2+cvs.031111-1.0woody.1 |
| 38 | echo libgdal1 hold | dpkg --set-selections |
| 39 | |
| 40 | As usual, apt will uninstall any previously installed libgdal1. |
| 41 | |
| 42 | == What's missing? == |
| 43 | So what's missing? WFS-Server, Flash/Ming?, Mapscript for all other languages besides Perl, PostGIS, MyGIS?, SDE, Oracle, and PDF. If you need these features, either email the package maintainer, Paul Baker at mailto:pbaker@where2getit.com, and/or build MapServer yourself following steps below. |
| 44 | |
| 45 | == Compiling MapServer for Debian == |
| 46 | This description relates to pre-woody (Debian r2.x) releases. Many of the supporting libraries are now available as packages, and many of the steps described here are likely to be obsolete. |
| 47 | |
| 48 | 0.1 Install Debian Woody base system |
| 49 | You'll want to read http://www.debian.org/releases/stable/installmanual for instructions on that. |
| 50 | 0.2 Compile kernel 2.4.18 so we have ext3 filesystems |
| 51 | 0.3 Install useful packages |
| 52 | |
| 53 | apt-get install sash # A statically link root shell for fixing fatal mistakes |
| 54 | apt-get install sshd # Secure shell because telnet is bad. |
| 55 | apt-get install dpkg-dev # Needed to use source packages |
| 56 | |
| 57 | Stable version of tune2fs doesn't support ext3 journals, use testing version of the e2fsprogs package |
| 58 | |
| 59 | vi /etc/apt/sources.list; apt-get update # point apt at testing distro |
| 60 | apt-get install e2fsprogs |
| 61 | |
| 62 | Since writing this, I have left apt pointing to testing (woody) since most of the libraries are closer to what Mapserver wants compared to stable (2.2r6). |
| 63 | |
| 64 | 0.4 Update filesystems to use ext3 |
| 65 | |
| 66 | 1.0 Installing support libraries needed for Mapserver |
| 67 | |
| 68 | 1.1 Proj4 (v4.4.3-1) |
| 69 | My working Mapserver 3.5 box uses a compiled 4.4.3-2, but I notice 4.4.3 is available as a package. |
| 70 | |
| 71 | apt-get install proj |
| 72 | |
| 73 | 1.2 GD |
| 74 | Mapserver requires 1.2 or higher, at this time the Debian package is 1.7.3-0.1 |
| 75 | |
| 76 | apt-get install libgd1g |
| 77 | |
| 78 | libgd1g lists FreeType2? as a dependancy, FreeType? support is required by Mapserver: |
| 79 | |
| 80 | http://mapserver.gis.umn.edu/doc/unix-install-howto.html#d45e163 |
| 81 | |
| 82 | 1.3 PHP |
| 83 | I like DSOs for regular PHP work on the server, so let's compile a DSO for PHP and a CGI version that will only be used with PHPMapscript pages (.phtml) |
| 84 | |
| 85 | apt-get install flex # PHP needs lex to compile |
| 86 | apt-get install apache # else PHP and apache conflict on apache-common version |
| 87 | apt-get install apache-dev # PHP needs APXS to compile |
| 88 | apt-get install php4 |
| 89 | apt-get source php4 # Probably needed for PHPMapscript to compile against |
| 90 | |
| 91 | We need to compile PHP since the Debian pacakge has --with-regex=PHP while the 3.6 configure.in says that --with-system-regex should be used. (and we want a CGI as well anyway) |
| 92 | |
| 93 | 1.3.1 libPDF |
| 94 | I am currently compiling in libPDF into PHP, native Mapserver PDF may be a far neater solution, but this has been convenient and I can use PDF in other apps. PDFlib is not available as a package so we must compile it: |
| 95 | |
| 96 | cd /usr/src/pdflib-4.0.2 |
| 97 | ./configure |
| 98 | make |
| 99 | make test |
| 100 | make install |
| 101 | |
| 102 | 1.3.2 PosgreSQL? |
| 103 | |
| 104 | apt-get install libpgsql2 |
| 105 | |
| 106 | 1.3.2 Compiling and installing PHP |
| 107 | For PHP 4.1.2 source retrived by apt-source, I used: |
| 108 | |
| 109 | apt-get install libtiff3g # Required by PHP PDF functions |
| 110 | ./configure --with-mysql --with-apxs --with-regex=system --with-postgresql --with-pdflib=/usr/local --with-jpeg --with-tiff --with-zlib |
| 111 | make |
| 112 | |
| 113 | Since we are not making major changes, let's just replace the PHP DSO rather than running make install: |
| 114 | |
| 115 | cd /usr/lib/apache/1.3 |
| 116 | mv libphp4.so libphp4.so.debian412 |
| 117 | cp /usr/src/php4-4.1.2/.libs/libphp4.so libphp4.so.mapserv |
| 118 | ln -s libphp4.so.mapserv libphp.so |
| 119 | /etc/init.d/apache restart |
| 120 | |
| 121 | This creates an Apache DSO which Mapserver will refuse to use, but I want to keep the majority of my PHP running from the DSO. Therefore I will compile PHP a second time as a CGI and only associate PHP/Mapscript? with .phtml. To create a CGI php executable: |
| 122 | |
| 123 | ./configure --with-mysql --with-regex=system --with-postgresql --with-gd --with-jpeg --with-png --with-freetype --with-pdflib=/usr/local --with-zlib --enable-force-cgi-redirect |
| 124 | make |
| 125 | |
| 126 | To install, follow the instructions in PHPMapScriptCGI (in my case to associate .phtml with the CGI version of PHP), do read these instructions as there are important security considerations to be made. |
| 127 | |
| 128 | cp php /usr/lib/cgi-bin/ |
| 129 | vi /etc/apache/srm.conf |
| 130 | << AddHandler? phtml-script .phtml |
| 131 | << Action phtml-script /cgi-bin/php |
| 132 | vi /etc/apache/httpd.conf # uncommment mod_actions.so |
| 133 | /etc/init.d/apache restart |
| 134 | |
| 135 | 1.4 GDAL and OGR |
| 136 | GDAL wants g++, g++ wants libraries from the testing distribution so on advice from a Debian expert, I will leave apt pointed at testing. |
| 137 | |
| 138 | cd /usr/src/gdal-1.1.7 |
| 139 | apt-get install g++ |
| 140 | ./configure |
| 141 | make |
| 142 | make install # installs to usr/local/ ./bin, ./include, ./share and ./lib |
| 143 | vi /etc/ld.so.conf # add /usr/local/lib to libs |
| 144 | ldconfig # updates changes to ld.so.conf |
| 145 | |
| 146 | Mapserver 3.7 seems to require GDAL 1.1.8 for to get "CSLFetchBoolean?" |
| 147 | |
| 148 | 2.0 Compile Mapserver |
| 149 | Remember to remove ./config.cache if you change anything! I re-installed GD three times before I noticed this. |
| 150 | |
| 151 | apt-get install libwww0 # Needed by --with-wmsclient |
| 152 | apt-get install libwww-dev # Also needed by --with-wmsclient |
| 153 | apt-get install libjpeg62 # So GD can render jpgs |
| 154 | apt-get install libpng2 # So GD can render PNGs |
| 155 | apt-get install libgd-dev # replaces libgd1g and more |
| 156 | apt-get install proj # upgrade PROJ4 to 4.4.5 |
| 157 | |
| 158 | ./configure --with-gd --without-tiff --with-freetype --with-proj --with-ogr --with-gdal --with-wmsclient --with-php=/usr/src/php4-4.1.2/ |
| 159 | |
| 160 | make |
| 161 | |
| 162 | These notes were written for v 3.6.0, but I have recompiled using 3.6.3 and 3.7 with only minor differences (the replacement of libwww with libcurl and the addition of PDFlib and Ming). |
| 163 | |
| 164 | 3.0 Install Mapserver |
| 165 | |
| 166 | cp ./.libs/php_mapscript.so /usr/lib/php/20010901/ |
| 167 | # This next bit is an ugly hack until I set up PHP to look at |
| 168 | |
| 169 | # my extensions directory: |
| 170 | ln -s /usr/libs/php/20010901 /usr/local/lib/php4/extensions/no-debug-non-zts-20010901 |
| 171 | |
| 172 | cp mapserv /usr/lib/cgi-bin # Only needed for our older CGI based apps |
| 173 | |
| 174 | 4.0 Testing |
| 175 | |
| 176 | Install MapServer 4.2.2 and PHPMapScript from Debian Binary Packages |
| 177 | |
| 178 | Add the next line in /etc/apt/sources.list |
| 179 | |
| 180 | for testing: |
| 181 | |
| 182 | deb http://agrogeomatic.educagri.fr/debian sarge main |
| 183 | |
| 184 | for stable: |
| 185 | |
| 186 | deb http://agrogeomatic.educagri.fr/debian woody main |
| 187 | |
| 188 | And execute: |
| 189 | |
| 190 | apt-get update ; |
| 191 | apt-get install php-mapscript cgi-mapserver php4 |
| 192 | |
| 193 | More info in http://agrogeomatic.educagri.fr/debian |