#!/bin/sh # Mapnik setup on RHEL # these were used for the foss4g 2010 wms benchmark # are a bit crazy for two reasons: # 1) a custom prefix and LD_LIBRARY_PATH was used so that mapnik libs would not conflict with mapserver libs # 2) Combo of old libraries and yum package bugs meant I chose to install a bunch of things from source # See also: http://trac.mapnik.org/wiki/CentOS/RHEL # set dir to put sources src=/opt/mapnik/src # set dir to put builds build=/opt/mapnik/build # install prefix prefix=/opt/mapnik # setup custom paths export PATH=/sbin/:/usr/sbin:$prefix/bin:$prefix/sbin:/opt/mapnik/src/nik2img:/opt/mapnik/src/tilelite:$PATH # setup custom pythonpath export PYTHONPATH=/opt/mapnik/lib64/python2.6/site-packages/:$PYTHONPATH #export PYTHONPATH=/opt/mapnik/lib/python2.6/site-packages/:$PYTHONPATH export PROJ_LIB=/opt/mapnik/share/proj/ # set up library/linking environment either using LD_LIBRARY_PATH or global /etc/ld.so.conf export LD_LIBRARY_PATH=/opt/mapnik/lib:/opt/mapnik/lib64:/usr/lib64:/oracle/instantclient_11_2/ # set up the ld.conf for these libraries which will all go into /usr/local/lib #sudo bash -c 'echo "/usr/local/lib64" > /etc/ld.so.conf.d/local-x86.conf' #sudo bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf' #sudo ldconfig # update yum #sudo yum -y update #sudo yum -y upgrade # Add repos of EPEL - Extra Packages for Enterprise Linux sudo su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-3.noarch.rpm' #sudo yum update #sudo yum upgrade # install some base packages sudo yum install gcc-c++ gcc44-c++ bzip2-devel libtool-ltdl-devel libpng-devel libtiff-devel zlib-devel libjpeg-devel libxml2-devel #zlib-devel #libxml2-devel #libxslt-devel #libXft-devel #libxml2-devel #freetype-devel #openssl-devel #fontconfig-devel #libxslt-devel #fontconfig-devel #openssl-devel python-setuptools htop #freetype-devel libpng-devel zlib-devel # install these only if not already installed sudo yum install mercurial subversion # if we installed EPEL, grab packages from EPEL sudo yum install git-all python-nose scons # we need postgres dev libraries to build mapnik's postgis driver against # even though these are 8.1 (ancient!) - hopefully things won't break #sudo yum -y postgresql-devel # we need python headers to build boost_python and mapnik's python bindings # these come from EPEL sudo yum -y install python26-devel python26 # install a few python deps for mapnik's python wms server #sudo yum -y install python-lxml python-imaging # install SCons for builds #sudo easy_install scons # libicu-devel # python-devel # postgresql-devel postgresql-server #sudo yum -y groupinstall 'Development Tools' # optimize builds export CFLAGS=-O3 export CXXFLAGS=-O3 cd $src wget ftp://anonymous@xmlsoft.org/libxslt/libxslt-1.1.26.tar.gz tar xvf libxslt-1.1.26.tar.gz cd libxslt-1.1.26 ./configure --with-libxml-prefix=/opt/mapnik/bin/xml2-config --with-libxml-src=/opt/mapnik/src/libxml2-2.7.7 --prefix=$prefix #libxml2 cd $src wget ftp://anonymous@xmlsoft.org/libxml2/libxml2-2.7.7.tar.gz tar xzf libxml2-2.7.7.tar.gz cd libxml2-2.7.7 ./configure --with-zlib=/opt/mapnik/lib --prefix=$prefix --without-iconv --with-threads make make install # zlib cd $src wget http://zlib.net/zlib-1.2.5.tar.gz tar xzf zlib-1.2.5.tar.gz cd zlib-1.2.5 ./configure --prefix=$prefix make make install # libpng cd $src wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.4.3.tar.gz tar xzf libpng-1.4.3.tar.gz cd libpng-1.4.3 ./configure --prefix=$prefix make make install # freetype2 cd $src wget http://mirror.its.uidaho.edu/pub/savannah/freetype/freetype-2.4.1.tar.gz tar xzf freetype-2.4.1.tar.gz cd freetype-2.4.1 ./configure --prefix=$prefix --with-pkgconfigdir=$prefix/lib/pkgconfig make make install # proj4 cd $src wget http://download.osgeo.org/proj/proj-4.7.0.tar.gz wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip tar xzf proj-4.7.0.tar.gz cd proj-4.7.0/nad unzip ../../proj-datumgrid-1.5.zip cd .. ./configure --prefix=$prefix make -j4 sudo make install #sudo ldconfig # build external jpeg cd $src wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz tar xvf jpegsrc.v8b.tar.gz cd jpeg-8b ./configure --prefix=$prefix make -j4 make install # build external libtiff cd $src export CVSROOT=:pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot cvs login cvs checkout libtiff cd libtiff ./configure \ --prefix=$prefix \ --with-jpeg-lib-dir=$prefix/lib \ --with-jpeg-include-dir=$prefix/include \ --with-zlib-lib-dir=$prefix/lib \ --with-zlib-include-dir=$prefix/include \ make -j6 make install # gdal cd $src #wget http://download.osgeo.org/gdal/gdal-1.7.2.tar.gz #tar xzf gdal-1.7.2.tar.gz #cd gdal-1.7.2 svn co http://svn.osgeo.org/gdal/trunk/gdal gdal-trunk cd gdal-trunk ./configure \ --prefix=$prefix \ --with-libtiff=$prefix \ --with-geotiff=internal \ --with-jpeg=$prefix \ --with-libz=$prefix \ --with-zlib=$prefix \ --with-png=$prefix \ --with-curl=no \ --with-pg=no \ --with-threads make -j6 make install # icu cd $src wget http://download.icu-project.org/files/icu4c/4.4.1/icu4c-4_4_1-src.tgz tar xvf icu4c-4_4_1-src.tgz cd icu/source ./runConfigureICU Linux --prefix=$prefix --enable-icuio=no make -j4 make check sudo make install #sudo ldconfig #bjam \ #-NODEFAULTLIB:libcd \ #'-sBUILD=-m64 -fPIC -m64 #-fPIC -L/apps/Linux64/gcc334/lib64 #-Wl,-rpath /apps/Linux64/gcc334/lib64' #-d2 stage # boost cd $src wget http://voxel.dl.sourceforge.net/project/boost/boost/1.44.0/boost_1_44_0.tar.bz2 tar xjvf boost_1_44_0.tar.bz2 cd boost_1_44_0 # if we wanted to build against gcc44 (did not in this case) #echo "using gcc : 4.4 : /usr/bin/g++44 ; " >> tools/build/v2/user-config.jam ./bootstrap.sh vim project-config.jam # using python : 2.6 : /usr ; ./bjam -q \ --prefix=$prefix \ --build-type=minimal \ --with-thread \ --with-filesystem \ --with-iostreams \ --with-python \ --with-regex -sHAVE_ICU=1 -sICU_PATH=$prefix \ --with-program_options \ --with-system \ toolset=gcc \ release \ stage ./bjam -q \ --prefix=$prefix \ --build-type=minimal \ --with-thread \ --with-filesystem \ --with-iostreams \ --with-python \ --with-regex -sHAVE_ICU=1 -sICU_PATH=$prefix \ --with-program_options \ --with-system \ toolset=gcc \ release \ install #sudo ldconfig # install nose for python26 to test mapnik cd $src wget http://somethingaboutorange.com/mrl/projects/nose/nose-0.11.2.tar.gz tar xvf nose-0.11.2.tar.gz cd nose-0.11.2 python26 setup.py install # mapnik 0.7.2 cd $src svn co http://svn.mapnik.org/branches/0.7.2-dev/ cd 0.7.2-dev/ scons configure PREFIX=$prefix/mapnik-seven \ BOOST_INCLUDES=/opt/mapnik/include \ BOOST_LIBS=/opt/mapnik/lib \ OPTIMIZATION=3 \ PKG_CONFIG_PATH=$prefix/lib/pkgconfig \ INPUT_PLUGINS=shape,gdal,postgis,occi \ CAIRO=False \ PYTHON_PREFIX=$prefix \ PYTHON=/usr/bin/python26 \ DEMO=True \ OCCI_LIBS=/oracle/instantclient_11_2/ \ OCCI_INCLUDES=/oracle/instantclient_11_2/sdk/include/ \ scons install -j8 export LD_LIBRARY_PATH=/opt/mapnik/mapnik-seven/lib64/:$LD_LIBRARY_PATH # mapnik trunk cd $src svn co http://svn.mapnik.org/trunk/ mapnik-trunk cd mapnik-trunk scons configure PREFIX=$prefix \ BOOST_INCLUDES=/opt/mapnik/include \ BOOST_LIBS=/opt/mapnik/lib \ OPTIMIZATION=3 \ PKG_CONFIG_PATH=$prefix/lib/pkgconfig \ CAIRO=False \ SVG_RENDERER=False \ INPUT_PLUGINS=shape,gdal,postgis,occi \ PYTHON_PREFIX=$prefix \ PYTHON=/usr/bin/python26 \ DEMO=True \ OCCI_LIBS=/oracle/instantclient_11_2/ \ OCCI_INCLUDES=/oracle/instantclient_11_2/sdk/include/ \ scons install -j8 # nik2img for testing cd $src svn co http://mapnik-utils.googlecode.com/svn/trunk/nik2img/ cd nik2img # apply patch to work in place # change top of nik2img.py '#!/usr/bin/env python' --> '#!/usr/bin/python26' # add: sys.path.insert(0,'/opt/mapnik/lib64/python2.6/site-packages/') # tilelite for testing hg clone https://springmeyer@bitbucket.org/springmeyer/tilelite cd tilelite # apply patch to work in place # change top of tilelite.py and liteserv.py '#!/usr/bin/env python' --> '#!/usr/bin/python26' # add: sys.path.insert(0,'/opt/mapnik/lib64/python2.6/site-packages/') # install daemonize git clone git://github.com/bmc/daemonize.git cd daemonize # note: daemonize goes into $prefix/sbin by default ./configure --prefix=$prefix make -j4 make install # paleoserver cd $src git clone https://springmeyer@github.com/springmeyer/paleoserver.git cd paleoserver scons # apache for mod_mapnik cd $src wget http://www.poolsaboveground.com/apache/httpd/httpd-2.2.16.tar.gz tar xvf httpd-2.2.16.tar.gz cd httpd-2.2.16 ./configure --prefix=$prefix make -j4 make install # odd mod_mapnik bdb depedency cd $src wget http://download.oracle.com/berkeley-db/db-4.8.24.tar.gz tar xzf db-4.8.24.tar.gz cd db-4.8.24 cd build_unix ../dist/configure --prefix=$prefix --enable-cxx make install #sudo yum install gd-devel httpd-devel #2.2.3 cd $src svn co http://svn.openstreetmap.org/applications/utils/mod_mapnik_wms cd mod_mapnik_wms export CFLAGS="-I/opt/mapnik/include" export LDFLAGS="-L/opt/mapnik/mapnik-seven/lib64 -lmapnik -L/opt/mapnik/lib -lproj -lgd" # move mapnik2 headers away temporarily during build mv /opt/mapnik/include/mapnik/ /opt/mapnik/include/mapnik2/ # set up to link against mapnik 0.7.2 headers export LD_LIBRARY_PATH=/opt/mapnik/lib:/opt/mapnik/mapnik-seven/lib64 ./autogen.sh \ --prefix=$prefix \ --with-apxs=/opt/mapnik/bin/apxs \ --with-apr-config=/opt/mapnik/bin/apr-1-config \ --with-bdb-dir=/opt/mapnik \ --with-mapnik-headers=/opt/mapnik/mapnik-seven/include \ --with-mapnik-libdir=/opt/mapnik/mapnik-seven/lib64 make make install cp .libs/mod_mapnik_wms.so /opt/mapnik/modules/ mv /opt/mapnik/include/mapnik2 /opt/mapnik/include/mapnik # install mod_mapnik_wms against mapnik2 cd $src/mod_mapnik_wms export CXXFLAGS="-I/opt/mapnik/include -I/usr/include" export LD_LIBRARY_PATH=/opt/mapnik/lib:/opt/mapnik/lib64:/usr/lib export LDFLAGS="-L/opt/mapnik/lib64 -lmapnik2 -L/opt/mapnik/lib -L/usr/lib" ./autogen.sh \ --prefix=$prefix \ --with-apxs=/opt/mapnik/bin/apxs \ --with-apr-config=/opt/mapnik/bin/apr-1-config \ --with-bdb-dir=/opt/mapnik \ --with-mapnik-headers=/opt/mapnik/include \ --with-mapnik-libdir=/opt/mapnik/lib64 make make install cp .libs/mod_mapnik_wms.so /opt/mapnik/modules/ #### EDIT LoadFile commands in vhost # configure vhost cd /opt/mapnik/conf cp httpd.conf httpd.conf.og vim httpd.conf # change to custom port Listen 8091 # uncomment Include conf/extra/httpd-vhosts.conf cd extra cp httpd-vhosts.conf httpd-vhosts.conf.og vim httpd-vhosts.conf NameVirtualHost *:8091 PassEnv LD_LIBRARY_PATH LoadFile /usr/lib64/libstdc++.so.6 LoadFile /opt/mapnik/mapnik-seven/lib64/libmapnik.so.0.7 LoadFile /usr/lib64/libgd.so.2 LoadFile /opt/mapnik/lib/libdb-4.8.so LoadModule mapnik_wms_module /opt/mapnik/modules/mod_mapnik_wms.so # sudo vim /etc/hosts # 127.0.0.1 mod_mapnik ServerName mod_mapnik ServerAdmin dane@dbsgeo.com # this is required. it will pass all requests to our module. # if you want only *certain* requests passed to the module, you can use # a qualified version of SetHandler. SetHandler wms-handler #DocumentRoot /Users/dane/projects/mod_mapnik_wms/www/ # various mapnik configuration options. MapnikDatasources /opt/mapnik/mapnik-seven/lib64/mapnik/input MapnikFonts /opt/mapnik/mapnik-seven/lib64/mapnik/fonts/DejaVuSans-Bold.ttf MapnikFonts /opt/mapnik/mapnik-seven/lib64/mapnik/fonts/DejaVuSans.ttf MapnikFonts /opt/mapnik/mapnik-seven/lib64/mapnik/fonts/DejaVuSans-Oblique.ttf MapnikFonts /opt/mapnik/mapnik-seven/lib64/mapnik/fonts/VeraIt.ttf MapnikFonts /opt/mapnik/mapnik-seven/lib64/mapnik/fonts/Vera.ttf MapnikLog /opt/mapnik/logs/mapnik.log MapnikMap /opt/mapnik/benchmarking/2010/stylesheets/spain-vector.xml WmsSrs EPSG:4326 WmsTitle "Test Server" WmsUrl "http://mod_mapnik/" # start up /opt/mapnik/bin/httpd -k start # setup.. # don't make install!! hardcoded to debian setup #sudo cp .libs/mod_mapnik_wms.so /usr/libexec/apache2/mod_mapnik_wms.so #LoadModule mapnik_wms_module libexec/apache2/mod_mapnik_wms.so # install mod_wsgi for ogcserver wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz tar xvf mod_wsgi-3.3.tar.gz cd xvf mod_wsgi-3.3 ./configure \ --with-apxs=$prefix/bin/apxs \ --with-python=/usr/bin/python26 make make install # epel appears not to have PIL for python26 so we install from source wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz tar xvf Imaging-1.1.7.tar.gz cd Imaging-1.1.7 sudo python26 setup.py install # also install lxml sudo yum install libxslt-devel wget http://codespeak.net/lxml/lxml-2.2.8.tgz tar xvf lxml-2.2.8.tgz cd lxml-2.2.8 sudo python26 setup.py install # gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC # disable mod_mapnik_wms cd $prefix/conf/extra # move mod_mapnik one aside cp httpd-vhosts.conf httpd-vhosts_mod_mapnik.conf # create a new one for ogcserver cp httpd-vhosts.conf httpd-vhosts_ogcserver.conf # rm original and symlink ogcserver rm httpd-vhosts.conf ln -s `pwd`/httpd-vhosts_ogcserver.conf httpd-vhosts.conf # edit ogcserver vhost vim httpd-vhosts_ogcserver.conf NameVirtualHost *:8091 PassEnv LD_LIBRARY_PATH LoadModule wsgi_module /opt/mapnik/modules/mod_wsgi.so ServerName linux_wms_bm ServerAdmin dane@dbsgeo.com # # Order allow,deny # Allow from all # WSGIScriptAlias / /opt/mapnik/src/ogcserver/app.py WSGIDaemonProcess ogc user=dane group=wms processes=10 threads=1 WSGIProcessGroup ogc WSGIApplicationGroup %{GLOBAL} # build clang #cd $src #svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm #cd llvm/tools #svn co http://llvm.org/svn/llvm-project/cfe/trunk clang #cd .. #./configure --enable-optimized #make