Personal tools
Home » Members » scw » Ubuntu Server Installation
Document Actions

Ubuntu Server Installation

by Matthew Perry last modified 16-05-2007 16:49

This document outlines the procedure for setting up our GIS server software including Zope, Plone, Apache, PHP, GDAL, GRASS, PostGIS, Mapserver, Mapnik and PrimaGIS. The Ubunutu package system, while including many GIS packages, doesn't contain the latest versions with the latest features we need so we turn to compiling everything from source where it is necessary. This document also explains other server setup details such as the file structure and implementation details for various components.

Initial Setup

Use the Ubuntu Dapper Drake install CD and install in server mode.

First uncomment out the universe and multiverse lines in /etc/apt/sources.list and comment the cdrom source. It should look something like this:

# deb cdrom:[Ubuntu 6.04 _Dapper Drake_ - Alpha i386 (20060310)]/ dapper main restricted
# deb cdrom:[Ubuntu 6.04 _Dapper Drake_ - Alpha i386 (20060310)]/ dapper main restricted
deb dapper main restricted
deb-src dapper main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb dapper-updates main restricted
deb-src dapper-updates main restricted
## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb dapper universe main restricted multiverse
deb-src dapper universe
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
#deb dapper-backports main restricted universe multiverse
#deb-src dapper-backports main restricted universe multiverse
deb dapper-security main restricted
deb-src dapper-security main restricted
deb dapper-security universe
deb-src dapper-security universe

Now update the package list and do a system update:
sudo apt-get update
sudo apt-get dist-upgrade

Install some initial packages (some of which we will revist to configure later):

sudo apt-get install libreadline5 libreadline5-dev bison flex mysql-server-5.0 libsqlite3-dev \
sqlite3 libxerces27 libxerces27-dev libstdc++5-3.3-dev libstdc++5 python2.4-dev \
python2.4-numeric python2.4-numeric-ext expat libexpat1-dev curl libcurl3 \
libcurl3-openssl-dev libcurl3-dev libxml2 libxml2-dev unixodbc unixodbc-dev \
h5utils hdf5-tools libhdf5-serial-dev libhdf4g libhdf4g-dev libhdf4g-run netcdf-bin \
netcdfg-dev g++ gcc make ccache imagemagick xsltproc
sudo apt-get install gpsbabel avce00 shapelib unzip libmysql++-dev subversion cvs trac ssh

Set up ccache to speed up re-compile times:

sudo ln -s /usr/bin/ccache /usr/local/bin/gcc
sudo ln -s /usr/bin/ccache /usr/local/bin/g++

Base Libraries

Now create a src directory and start compiling some of the base dependencies:

export SRC=/usr/local/src

# ECW Drivers
# Registration required for download
cd $SRC
wget ""
ln -s libecwj2-3.3 libecw
cd libecw/
sudo make install

cd $SRC
curl | tar zxvf -
ln -s proj-4.5.0 proj
cd proj/nad
wget ""
cd ..
sudo make install

cd $SRC
curl | tar jxvf -
ln -s geos-2.2.3 geos
cd geos
sudo make install

cd $SRC
curl "" | tar zxvf -
ln -s ogdi-3.1.5 ogdi
cd ogdi-3.1.5
export TOPDIR=$SRC/ogdi
./configure --with-proj=/usr/local --with-expat --with-zlib
sudo make install

cd $SRC
curl | tar zxvf -
ln -s libdap-3.7.5 libdap
cd libdap
sudo make install

cd ~/src
wget ""
tar -xzvf jasper-1.900.0.uuid.tar.gz
ln -s jasper-1.900.0.uuid jasper
cd jasper
export CFLAGS='-fPIC'
sudo make install

# PostgreSQL
cd $SRC
curl | tar jxvf -
ln -s postgresql-8.2.3/ postgresql
cd postgresql
./configure --prefix=/usr/local --with-python
sudo make install

# PostGIS
cd contrib
curl "" | tar zxvf -
cd postgis-1.2.1
sudo make install

# PDFLib
cd $SRC
curl | tar zxvf -
ln -s PDFlib-Lite-7.0.0p3 pdflib
cd pdflib
./configure --with-ruby --with-rubyincl=/usr/lib/ruby/1.8/x86_64-linux/
sudo make install

# gpx2shp
cd ~/src
wget ""
tar -xzvf gpx2shp-0.69.tar.gz
cd gpx2shp-0.69
sudo make install


Now, finally, we can install GDAL with a good set of drivers:

curl "" | tar xzvf -
ln -s gdal-1.4.0 gdal
cd gdal
./configure \
--with-threads \
--with-ngpython \
--with-curl=/usr/bin \
--with-ecw=/usr/local \
--with-dods-root=/usr/local \
--with-sqlite=/usr \
--with-odbc=/usr \
--with-geos=/usr/local/bin/geos-config \
--with-xerces \
--with-xerces-inc=/usr/include/xercesc \
--with-xerces-lib="-L/usr/lib -lxerces-c -lpthread" \
sudo make install


Install GRASS from the CVS snapshot:

# First, some binary dependencies to take care of
sudo apt-get install freetype2 tcl8.3 tk8.3 tcl8.3-dev tk8.3-dev libmotif3 \
libmotif-dev libtiff4-dev libpng-dev libgl1-mesa-dev \
libglu1-mesa-dev fftw3-dev fftw3 freetype2-dev fftw2 \
fftw-dev libfreetype6-dev gettext
curl | tar zxvf -
ln -s grass-6.3.cvs_src_snapshot_2007_02_17 grass
cd grass
export CFLAGS="-O2 -mcpu=opteron -m64"
./configure --with-cxx \
--with-gdal=/usr/local/bin/gdal-config \
--with-freetype \
--with-freetype-includes=/usr/include/freetype2 \
--with-nls \
--with-postgres \
--with-readline \
--with-postgres-includes=/usr/local/include/postgresql \
--with-tcltk-includes=/usr/include/tcl8.3 \
--enable-largefile \
--with-x \
--with-odbc \
--with-sqlite \
--with-mysql \
--with-mysql-includes=/usr/include/mysql \
--with-mysql-libs=/usr/lib \
--enable-64bit \
sudo make install
sudo ln -s /usr/local/bin/grass61 /usr/local/bin/grass

Now we have to add the GRASS libs to ldconfig so the runtime linker catches them. Open /etc/ and add:


then run

sudo ldconfig

Now we have to install the gdal/grass bridge in order to give GDAL/OGR read access to GRASS rasters and vectors respectively:

# gdal-grass plugin
cd $SRC
curl "" | tar xzvf -
cd gdal-grass-1.3.2/
./configure --with-gdal=/usr/local/bin/gdal-config --with-grass=/usr/local/grass-6.3.cvs
sudo make install

R Statistics

Time to install R, the stats package along with some hooks for spatial data:

# R & all the spatial libraries
sudo apt-get install r-recommended
sudo R
install.packages(c("rgdal", "sp","maptools","gstat", "abind", "methods", "pixmap"), dependencies=TRUE)


Apache is our webserver of choice for all non-CMS content:

sudo apt-get install apache2 libapache2-mod-python libapache2-mod-fastcgi
# Register some required modules
sudo a2enmod actions
sudo a2enmod ssl
sudo a2enmod rewrite
sudo a2enmod suexec
sudo a2enmod include
# Configure for PHP-CGI (prep for next step)
sudo vi /etc/apache2/apache2.conf
# Add
# For PHP scripts as CGI-BIN
AddType application/x-httpd-php-cgi .php .php4 .phtml
AddHandler application/x-httpd-php-cgi /cgi-bin/php4

# Add php scripts and html to /var/www

PHP web scripting

Because of thread safety issues and general lack of moderneity in the GIS stack, we have to use php4 as a CGI as opposed to an apache module:

cd ~/src
tar -xzvf php-4.4.2.tar.gz
cd php-4.4.2
sudo apt-get install bzip2 libbz2-dev libxslt1-dev libgd2-noxpm-dev sablotron libsablot0-dev
./configure --enable-shared --with-regex=system --with-jpeg-dir=/usr \
--with-png-dir=/usr --with-zlib --with-gd=/usr --with-freetype-dir=/usr \
--enable-force-cgi-redirect --enable-dbase --without-pdflib --with-mysql \
--with-config-file-path=/usr/local/php4/ --prefix=/usr/local/php4 \
--enable-xslt \
--with-xslt-sablot=/usr \
--enable-fastcgi \
--with-openssl \
--with-kerberos \
--with-zlib \
--with-bz2 \
--with-curl \
--enable-dbase \
--with-gd \
--with-pgsql \
--with-xsl \
--with-mysql \
--with-gettext \
sudo make install
sudo mkdir /usr/local/php4/extensions
sudo cp ~/src/php-4.4.2/php.ini-dist /usr/local/php4/php.ini
sudo vi /usr/local/php4/php.ini
# Change
# copy php to cgi-bin
sudo cp /usr/local/php4/bin/php /usr/lib/cgi-bin/php4
sudo apache2ctl restart


OK after all that, we're finally ready to install Mapserver:

# Mapserver
cd ~/sr
tar -xzvf mapserver-4.8.3.tar.gz
cd mapserver-4.8.3
./configure \
--without-tiff \
--with-jpeg \
--with-png \
--with-freetype \
--with-zlib \
--with-threads \
--with-proj \
--with-gdal=/usr/local/bin/gdal-config \
--with-wcs \
--with-ogr \
--with-wmsclient \
--with-wfsclient \
--with-wfs \
--without-pdf \
--with-geos \
--enable-debug \
--with-php=/home/perrygeo/src/php-4.4.2 \
--with-postgis=/usr/local/bin/pg_config \
--with-curl-config=/usr/bin/curl-config \
sudo cp mapserv /usr/lib/cgi-bin/
sudo cp shp2img shptree shptreetst shptreevis sortshp tile4ms scalebar legend /usr/local/bin/

We need to prep our htdocs directory for mapserver to cache images:

mkdir ~/www/tmp
# Must be writable by web user and other apps
chmod 775 ~/www/tmp
sudo chown www-data ~/www/tmp
# Later you can configure your mapfile like so
# IMAGEPATH "/var/www/tmp/"
# IMAGEURL "/tmp/"

Create a shell script ( /usr/local/bin/ ) to clean out this dir

# clear out old temp images if they're over 2 hrs old
find /var/www/tmp -type f -amin +120 -exec rm {} \;

and add this as a cron task

export EDITOR=vi && crontab -e
# Add
00 03 * * * /usr/local/bin/

Now to install the Mapscript bindings for our favorite scripting languages:

# Mapscript (PHP)
sudo cp mapscript/php3/ /usr/local/php4/extensions/
# Mapcript (Python)
cd mapscript/python
sudo apt-get install swig
swig -python -modern -o mapscript_wrap.c ../mapscript.i
sudo python install


Now for an alternate web server, our Zope system:

sudo apt-get install zope2.9 python2.4-imaging
export INSTANCE=ebm
sudo /usr/lib/zope2.9/bin/ -d /var/lib/zope2.9/instance/${INSTANCE}
# give user pass at interactive prompt

Now install the Plone CMS on top of that. note that the URL below is for the beta version and hopefully the 2.5 final will be released by the time we install it:

cd ~/src
tar -xzvf Plone-2.5.tar.gz
cd Plone-2.5
sudo cp -r * /var/lib/zope2.9/instance/${INSTANCE}/Products/
sudo /var/lib/zope2.9/instance/${INSTANCE}/bin/zopectl start
# OR
sudo /etc/init.d/zope2.9 restart

And we may eventually need some of these python modules so we'll toss 'em in here:

# some additional useful python modules
sudo apt-get install python2.4-psycopg python-wxgtk2.4 python2.4-sqlite \
python-gtk2-dev python-pysqlite2 python-celementtree python-lxml python2.4-numarray python2.4-twisted \
python2.4-adodb python2.4-rpy python2.4-scipy python-cherrypy2.1 python2.4-reportlab python2.4-matplotlib


Now for some cutting edge cartography software, Mapnik. Ostensibly there is even a WMS server so it could be a nice alt. to mapserver

# mapnik
sudo apt-get install \
libboost-python1.33.1 libboost-python-dev \
libboost-regex1.33.1 libboost-regex-dev \
libboost-serialization-dev \
libboost-signals1.33.1 libboost-signals-dev \
libboost-thread1.33.1 libboost-thread-dev \
libboost-program-options1.33.1 libboost-program-options-dev \
libboost-filesystem1.33.1 libboost-filesystem-dev \
libboost-iostreams1.33.1 libboost-iostreams-dev
cd ~/src
svn checkout svn:// mapnik
cd mapnik
python scons/ PYTHON=/usr/bin/python PGSQL_INCLUDES=/usr/local/include/postgresql \
PGSQL_LIBS=/usr/local/lib/postgresql BOOST_INCLUDES=/usr/include/boost BOOST_LIBS=/usr/lib
sudo python scons/ install PYTHON=/usr/bin/python PGSQL_INCLUDES=/usr/local/include/postgresql \
PGSQL_LIBS=/usr/local/lib/postgresql BOOST_INCLUDES=/usr/include/boost BOOST_LIBS=/usr/lib
sudo ldconfig

Now to configure the experimental WMS server:

cd ~/src
tar -xzvf jonpy-0.06.tar.gz
cd jonpy-0.06/
sudo python install

# copy the ogcserver stuff into its own dir
mkdir ~/mapnik; cd ~/mapnik
cp ~/src/mapnik/utils/ogcserver/* .
vi ogcserver.conf

Create our module defining data sources, styles, etc.( ) :

from mapnik.ogcserver.WMS import BaseWMSFactory
from mapnik import *
class WMSFactory(BaseWMSFactory):
def __init__(self):
sty = Style()
rl = Rule()
sty.rules.append( rl )

self.register_style('style1', sty)

lyr = Layer(name='layername', type='shape', \


Now we need to set up apache to handle fastcgi:

sudo apt-get install libapache2-mod-fcgid
sudo a2enmod fcgid

sudo vi /etc/apache2/sites-enabled/000-default
        ScriptAlias /fcgi-bin/ /usr/lib/fcgi-bin/
        <Directory "/usr/lib/fcgi-bin">
                AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
                SetHandler fastcgi-script

sudo mkdir /usr/lib/fcgi-bin

Now create the actual server script as /usr/lib/fcgi-bin/wms

#!/usr/bin/env python
# Your mapnik dir containing the map factory
# must be in the python path!
import sys
from mapnik.ogcserver.cgiserver import Handler
import jon.fcgi as fcgi
class WMSHandler(Handler):
    configpath = '/home/perrygeo/mapnik/ogcserver.conf'
fcgi.Server({fcgi.FCGI_RESPONDER: WMSHandler}).run()

In order to get Mapnik to accept non OGC parameters that some wms clients like to tack on (such as the UNIQUEID parameter for mapbuilder), we have to modify mapnik/ogcserver/ You can simply comment out

        #for paramname in params.keys():
# if paramname not in self.SERVICE_PARAMS[requestname].keys():
 # raise OGCException(’Unknown request parameter “%s”.’ % paramname)

Restart Apache

sudo /etc/init.d/apache2 force-reload

Now you can access it with a WMS request like so:,-90,180,90&width=600&height=300&format=image/png&styles=&srs=EPSG:4326

Configure Postgresql

sudo adduser postgres
# run through interactive prompt
sudo su postgres
mkdir ~/data
chmod -R 700 data
/usr/local/bin/initdb -D /home/postgres/data
/usr/local/bin/pg_ctl start -D /home/postgres/data -l /home/postgres/data/logfile
vi /home/postgres/data/pg_hba.conf
# Change all 'trust' to 'md5' to force authentication
/usr/local/bin/psql -d gisdata -c "ALTER USER postgres WITH ENCRYPTED PASSWORD 'doublesecret'"
/usr/local/bin/pg_ctl restart -D /home/postgres/data -l /home/postgres/data/logfile
/usr/local/bin/createdb gisdata
/usr/local/bin/psql -d gisdata -c "CREATE USER perrygeo WITH CREATEUSER CREATEROLE CREATEDB ENCRYPTED PASSWORD 'shhh'"
/usr/local/bin/psql -d gisdata -c "GRANT ALL ON DATABASE gisdata TO perrygeo"
# Now we can work from our normal user account
createlang plpgsql gisdata
psql -d gisdata -f /usr/local/share/postgresql/contrib/lwpostgis.sql
psql -d gisdata -f /usr/local/share/postgresql/contrib/spatial_ref_sys.sql

Create an debian rc init script

Using vi, create /etc/init.d/postgres

#! /bin/sh
# postgresql init.d script
. /lib/lsb/init-functions
case "$1" in
log_begin_msg "Starting postgresql server ..."
su postgres -c "/usr/local/bin/pg_ctl start -l /home/postgres/data/logfile -D /home/postgres/data"
log_end_msg $?
log_begin_msg "Stoping postgresql server ..."
su postgres -c "/usr/local/bin/pg_ctl stop -D /home/postgres/data"
log_end_msg $?
log_begin_msg "Restarting postgresql server ..."
su postgres -c "/usr/local/bin/pg_ctl stop -D /home/postgres/data"
su postgres -c "/usr/local/bin/pg_ctl start -l //home/postgres/data/logfile -D /home/postgres/data"
log_end_msg $?
echo "Usage: /etc/init.d/postgres {start|stop|restart}"
exit 1
exit 0

Make sure it has the proper permissions

sudo chmod +x /etc/init.d/postgres

Then add the init script to the system startups

update-rc.d postgres defaults

Configure Mysql

mysqladmin -u root password doublesecret
mysql -u root -p
# enter at mysql> prompt
GRANT ALL PRIVILEGES ON gisdata.* TO 'perrygeo'@'localhost' IDENTIFIED BY 'shhh' WITH GRANT OPTION;
#login in as normal user
mysql -D gisdata -p

Extra Tools

DEM Processing

cd ~/src
mkdir gdaldemtools
cd gdaldemtools
wget ""
g++ hillshade.cpp -lgdal -o hillshade
g++ color-relief.cxx -lgdal -o color-relief
g++ aspect.cpp -lgdal -o aspect
g++ slope.cpp -lgdal -o slope
sudo cp slope aspect color-relief hillshade /usr/local/bin/


sudo apt-get install autoconf2.13 automake1.8 checkinstall \
autobook autoconf-archive gnu-standards
cd ~/src# starspan
cvs -z3 checkout starspan
cd starspan
./configure --with-gdal=/usr/local/bin/gdal-config --with-geos=/usr/local/bin/geos-config
make install

PyDap - OpenDAP/DODS server

# pyDap Server
cd ~/src
tar -xzvf dap-2.1.4.tar.gz
cd dap-2.1.4/
sudo python install
sudo easy_install paste

PrimaGIS Stack

Python Cartographic Library

cd ~/src
sudo svn checkout PCL
cd PCL/PCL-Cartography
sudo python build_ext -I ~/src/mapserver install
cd ../PCL-Referencing
sudo python build_ext -I ~/src/mapserver install
cd ../PCL-Spatial
sudo python install
cd ../PCL-Data
sudo python install
cd ../OWSlib
sudo python install
cd ../PCL-Mapserver
ms_home = /usr/local/src/mapserver
sudo python build sudo python install

This is the SVN version of PCL -- here be dragons.

Hit problems when trying to render the map with
As per Hobu's suggestion:

cd /usr/local/src/mapserver/mapscript/python/
vi mapscript_wrap.c:
/* comment out intarray_set method */
sudo python clean
sudo python build
sudo python install

Zope Cartographic Objects

cd ~/src
tar -xzvf ZCO-0.7.3.tar.gz
export INSTANCE=ebm
sudo cp -R ZCO-0.7.3 /var/lib/zope2.9/instance/${INSTANCE}/Products/ZCO
sudo ln -s /usr/local/share/proj/epsg /usr/local/share/proj/EPSG

GeoAware Objects et. al.

cd ~/src
tar -xzvf CMFSin-0.6.1.tar.gz
tar -xzvf GeoAwareObjects-0.2.0.tar.gz
sudo cp -R CMFSin /var/lib/zope2.9/instance/${INSTANCE}/Products/CMFSin
sudo cp -R GeoAwareObjects /var/lib/zope2.9/instance/${INSTANCE}/Products/GeoAwareObjects


# PrimaGIS
cd ~/src
tar -xzvf PrimaGIS-0.5.0.tar.gz
sudo cp -r PrimaGIS/ /var/lib/zope2.9/instance/${INSTANCE}/Products/PrimaGIS


sudo /etc/init.d/zope2.9 restart

Now to install the demo

vi create world_borders.ovf
# create
<OGRVRTLayer name="world_borders">mkdir ~/data; cd ~/data; mkdir world_borders; cd world_borders
<SrcDataSource relativeToVRT="1">world_borders.shp</SrcDataSource>
mkdir ~/mapfiles; cd ~/mapfiles
vi fontset.txt
# create
Vera /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf
georgia_bold /usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf

all this has to be done in the ZMI

# create the plone site ('ebm')
# /ebm/portal_quickinstaller
# Select ALL products and click Install
# Point browser to http://host/ebm/portal_skins/primagis/createPrimaGISDemo
# in /ebm/demo/zco:
# point map renderer to proper text file
# point raw data to proper .ovf file


http://host/ebm/demo/primagis/ shows :

<Products.CMFCore.PortalFolder.PortalFolderBase object at 0xab0902c>

http://host/ebm/demo/primagis/base_view shows the contents in text nstead of the map. 

Ahah. http://host/ebm/demo/primagis/primagis_view works. But the interface defaults to /ebm/demo/primagis/.

The fix is in ZMI: /ebm/portal_types/PrimaGISMap

Add primagis_view as the Default method under the alias tab.

Also, there is a problem with the Titles not showing up in the menu. Just go to the edit tab and resave it and it shows up. Wierd.

Web Maping Client Interfaces


cd ~/www
cvs login
cvs co ka-map
cd ka-map/include
cp config.dist.php config.php
vi config.php
# line 49 :
# $szBaseCacheDir = "/var/www/tmp/kacache/";
# $szBaseWebCache = "tmp/kacache/";

chmod 775 ~/www/tmp/kacache
mkdir ~/www/tmp/kacachesudo chown -R nobody ~/www/tmp/kacache


cd ~/www
# The demos are fully functional out-of-the-box since they hit external WMS servers. Check them out at http://host/mapbuilder/


cd ~/www


cd ~/www
mkdir wmsmap; cd wmsmap


cd ~/www/mscross; cd ~/www/mscross
wget ""
mv download.php\?l\=en\&id\=mscross-1.1.2.js mscross.js
# Get all the images and put them in /img mkdir ~/www/img; cd ~/www/img wget wget wget wget wget wget

Set up SVN and Trac Server

follow the instructions at

mkdir ~/svn
svnadmin create ~/svn
svn import ~/www/mww file:///home/perrygeo/svn/mww -m "initial import"

#If just using locally, you can check it out like so
svn co file:///home/perrygeo/svn/mww

#start the server daemon
svnserve -d -r /home/perrygeo/svn/
# check out using the svn:// address
svn co svn://localhost/mww
# Now check it out on a remote machine, make some edits to a file
# and commit them.
svn commit -m "first revision" mww.php
# Create an init.d script
sudo vi /etc/init.d/svnserve
#! /bin/sh
. /lib/lsb/init-functions
case "$1" in
log_begin_msg "Starting subversion server ..."
su www-data -c "/usr/bin/svnserve -d -r /home/perrygeo/svn/"
log_end_msg $?
log_begin_msg "Stoping subversion server ..."
su www-data -c "killall svnserve -u www-data"
log_end_msg $?
log_begin_msg "Restarting postgresql server ..."
su www-data -c "killall svnserve -u www-data"
su www-data -c "/usr/bin/svnserve -d -r /home/perrygeo/svn/"
log_end_msg $?
echo "Usage: /etc/init.d/svnserve {start|stop|restart}"
exit 1
exit 0
sudo update-rc.d svnserve defaults

Once SVN is working properly, you can set up Trac for the project management and web browsing of the svn repos. in this case I set it up as a CGI but it can also be done with mod_python.

# everything else is default
project: EBM Projects
svn: /home/perrygeo/svn
chmod -R 775 trac
sudo chown -R www-data trac

trac-admin ~/trac initenv
htpasswd -c ~/trac/trac.htpasswd perrygeo

# Set up the developer group
trac-admin ~/trac permission add developer WIKI_ADMIN
trac-admin ~/trac permission add developer REPORT_ADMIN
trac-admin ~/trac permission add developer TICKET_MODIFY
trac-admin ~/trac permission add perrygeo developer

vi /etc/apache2/sites-enabled/000-default
ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi
<Location "/trac">
SetEnv TRAC_ENV "/home/perrygeo/trac"

<Location "/trac/login">
AuthType Basic
AuthName "Trac"
AuthUserFile /home/perrygeo/trac/trac.htpasswd
Require valid-user

#restart apache & access it at:

Geoserver (alternate WMS/WFS server)

cd /opt
sudo chown -R /opt perrygeo
tar -xzvf geoserver-1.3.1beta-bin.tar.gz

Now you have to download the JDK from After swimming through the alphabet soup that it the java marketing department, you should have a file called j2eesdk-1_4_03-linux.bin . Make sure you've got a quarter-GB for installation!

chmod +x j2eesdk-1_4_03-linux.bin
sudo apt-get install libstdc++2.10-glibc2.2
Administration Port [4848]
HTTP Port [2067]
HTTPS Port [8181]

This reports some info that may be useful someday if we want to set up a j2ee admin server. OPTIONAL.

Next Steps:
1. Access the About Application Server PE 8 welcome page at:
2. Start the Application Server by executing:
/opt/java/bin/asadmin start-domain domain1
3. Start the Admin Console:
4. Access sample applications:

set up the environment in you bash shell then source .bashrc


now set up geoserver's server:

cd /opt/geoserver
vi documents/jetty.xml
<Set name="Port"><SystemProperty name="GEOSERVER_PORT" default="8090"/></Set>

vi bin/
# Add same lines to bin/

Now run /opt/geoserver/bin/ and access the server at It will take some time to configure itself after which you should see the welcome screen.

Warning Geoserver's security model sucks. In fact it is non existent. If you set up a vector layer to be served by WFS, ANYONE who knows the URL has full read/write access to you GIS data. I would not consider geoserver for production for this reason alone.

Finally, for completeness sake, set up a init.d script

sudo chown -R www-data geoserver/
sudo chmod -R 775 geoserver/
sudo vi /etc/init.d/geoserver
#! /bin/sh
. /lib/lsb/init-functions
case "$1" in start) log_begin_msg "Starting geoserver ..." su www-data -c "/opt/geoserver/bin/" log_end_msg $? ;; stop) log_begin_msg "Stoping geoserver ..." su www-data -c "/opt/geoserver/bin/" log_end_msg $? ;; restart|force-reload) log_begin_msg "Restarting geoserver ..." su www-data -c "/opt/geoserver/bin/" su www-data -c "/opt/geoserver/bin/" log_end_msg $? ;; *) echo "Usage: /etc/init.d/geoserver {start|stop|restart}" exit 1 ;; esac exit 0 ----
sudo chmod +x /etc/init.d/geoserver

PHP PgAdmin

sudo apt-get install phppgadmin
cp -r phpPgAdmin-4.0.1/ /opt/phppgadmin
sudo vi /etc/apache2/sites-enabled/000-default
Alias /phppgadmin/ "/opt/phppgadmin/"
<Directory "/opt/phppgadmin/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
AuthType Basic
AuthName "PhpPgAdmin"
AuthUserFile /opt/phppgadmin/.htpasswd
Deny from all
Allow from ::1/128
edit /opt/phpgadmin/conf/
# point to proper paths etc

sudo chown -R www-data /opt/phppgadmin/
sudo htpasswd -c /opt/phppgadmin/.htpasswd perrygeo
# give password

# Access at http://host/phppgadmin/

Metadata management & data portals


cd /opt

# Needs X11 to run the installer :-(
sudo apt-get install x-window-system-core x11-common xterm
sudo dpkg-reconfigure x11-common
# allow Anybody, probably not safe or necessary
sudo xauth -b quit
sudo ln -s /usr/X11R6/bin /usr/bin/X11
cd /opt/java/jdk/jre/lib/i386
sudo chmod +x awt_robot

# relogin wih ssh -X
cd /opt
java -jar geonetwork-intermap-2.0.2-install.jar
# run through the graphic installer
# access at

To do: create inti.d script (geonetwork)


cd ~/www
tar -xzvf mediawiki-1.6.5.tar.gz
mv mediawiki-1.6.5 wiki
cd wiki
chmod a+w config
# run through web setup (linked from http://host/wiki)
# create user "wikiuser" to own the new db
cp config/LocalSettings.php .
#access at http://host/wiki


Moodle is great software for setting up a online learning environment; complete courses may be taught through moodle.

cd ~/www
tar -xzvf moodle-latest-15.tgz
cd moodle
mkdir ~/.moodledata
sudo chown www-data ~/.moodledata
sudo chmod 775 ~/.moodledata
mysql -p -u root
# > create database moodle
# > GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost' IDENTIFIED BY 'moodlepass' WITH GRANT OPTION;
# Go through installer at http://host/moodle/

Still to do

Examples using these software packages to work with real spatial data is documented at  Web Mapping Setup

System Admin scripts

cron tasks / scripts to automate

  • postgres vacuum
  • postgres backups
  • filesystem backups
  • logfile rotation
  • tmp directory cleanup
  • Ruby, Perl mapscript

network filesystem (Samba and/or NFS)


Built with Plone