Version 5 (modified by David Bitner, 11 years ago) ( diff )


Installation of GIS Tools on Linux

Suggest these CLI tools for data manipulation:


(alternatively these can be installed as part of OpenGeoSuite)

apt-get install postgresql-8.3-postgis
su postgres
createdb gis
createlang plpgsql gis
psql -d gis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
psql -d gis -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
  • Add Spherical Mercator projection (900913. See for 54004):
    psql gis
    INSERT into spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) values (900913 ,'EPSG',900913,'GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563,AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], NIT["degree",0.017453292519943295], AXIS["Longitude", EAST], AXIS["Latitude", NORTH],AUTHORITY["EPSG","4326"]], PROJECTION["Mercator_1SP"],PARAMETER["semi_minor", 6378137.0], PARAMETER["latitude_of_origin",0.0], PARAMETER["central_meridian", 0.0], PARAMETER["scale_factor",1.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0],UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH],AUTHORITY["EPSG","900913"]] |','+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs');
  • Allow remote access:
    passwd postgres
    vim /etc/postgresql/8.3/main/postgresql.conf
    listen_addresses = '*'
    vim /etc/postgresql/8.3/main/pg_hba.conf
    host    all         all         my.ip.add.ress/24     md5
    /etc/init.d/postgresql-8.3 restart
    vim /etc/iptables.rules
    -A INPUT -p tcp --dport 5432 -j ACCEPT
    su postgres
    createuser -s -P gis

(Don't do remote access as 'postgres' - to do so means can't simply access psql via 'su postgres')

  • Adjust postgresql.conf for performance relative to resources available
    max_connections -- default is 100, this is probably ok, adjust upward _or_ add a connection pooling layer like pgpool if running out of connections for clients
    shared_buffers -- default is 24MB, amount of shared memory that is held across all connections for caching frequently requested data.  The ideal is if all frequently accessed indexes and table rows can fit in here -- this is often unrealistic and setting too high relative to system resources can be detrimental to the system. At the high end this should be no more than 1/4 to 1/3 the available memory (ie that which is not being used by the OS or other processes). For a 512MB memory system, start at 56MB. For a 1G memory system start at 160MB. Those should both be quite conservative, so if you notice the database is slow and there are plenty of system resources at full load move them up a bit, but absolutely no more than 1/3 available memory.
    effective_cache_size -- default 128MB, this is used by the query optimizer to decide when to use an index vs. a sequence scan -- this does not control how much memory is used it is simply used to help optimize how the database is going to execute queries. 1/2 total memory is a conservative starting point.
    work_mem -- default 1MB, this is a per sort setting, so setting this too high with a high number of max_connections can be bad.  If the database load turns out to have a lot of sorting and not a lot of separate connections, you should increase this and drop the max_connections. Bump this up to 2MB to start with on a 512M system, 4MB on a 1G system.
    maintenance_work_mem -- default 16MB, memory available to the vacuum process. As you get more memory in the system, moving this up can be quite useful if you notice vacuum processes taking forever.


vim /etc/apt/sources.list
# for sun-java packages in unstable
deb unstable non-free
deb-src unstable non-free

apt-get update
apt-get install sun-java6-jdk
vim /etc/profile
export JAVA_HOME


  • Download the JDK & install it:
    cd /usr/local
    sh ~/jdk-6u21-linux-i586.bin
    ln -sf /usr/local/jdk1.6.0_21 /usr/local/java
    vim /etc/profile
    export JAVA_HOME

Apache Tomcat

Tomcat is the recommended way to deploy Java applications

  • Debian:
    apt-get install sun-java6-jdk tomcat5.5 libapache2-mod-jk
    a2enmod jk
    vim /etc/libapache2-mod-jk/
    vim /etc/init.d/tomcat5.5
    /etc/init.d/tomcat5.5 restart




apt-get install unzip

cd /var/lib/tomcat5.5/webapps
unzip ~/

/etc/init.d/tomcat5.5 restart

vim /etc/iptables.rules
-A INPUT -p tcp --dport 8180 -j ACCEPT


  • l: admin
  • p: geoserver

Change the password


cd /usr/local
unzip ~/
ln -sf /usr/local/geoserver-2.0.2 /usr/local/geoserver

vim /etc/profile

vim /etc/rc.local
/usr/local/geoserver/bin/ &

vim /etc/iptables.rules
-A INPUT -p tcp --dport 8080 -j ACCEPT





For Printing TMS layers, need to compile the Trunk version of the MapFish Print Module & then serve the resultant .war with Tomcat:

  1. Ensure that JAVA_HOME points to a JDK.
  2. Download & build source:
    svn checkout
    cd trunk
    ./gradlew build
  3. Configure Tomcat
    vim /etc/tomcat5.5/policy.d/04webapps.policy
    permission "/var/lib/tomcat5.5/webapps/print-servlet-1.2-SNAPSHOT/WEB-INF/classes/", "read";
    /etc/init.d/tomcat5.5 restart
    vim /etc/apache2/sites-available/print
    ln -s /etc/apache2/sites-available/print /etc/apache2/sites-enabled/print
    /etc/init.d/apache2 restart
  4. Copy the WAR file to your %WEBAPPS% directory:
    cp trunk/build/libs/print-servlet-1.2-SNAPSHOT.war /var/lib/tomcat5.5/webapps
  5. (re)Start Tomcat
  6. Configure the Map URL for Eden to:
  7. Configure %WEBAPPS%\print-servlet-1.2-SNAPSHOT\config.yaml:

Printing can also be done within GeoServer:

However this version doesn't yet support TMS layers, like OpenStreetMap.

cd /usr/local/geoserver-2.0.2/webapps/geoserver/WEB-INF/lib
unzip ~/
cd /usr/local/geoserver-2.0.2/data_dir
unzip ~/
/usr/local/geoserver/bin/ &
  • Configure by editing /usr/local/geoserver-2.0.2/data_dir/printing/config.yaml according to Documentation

Print to Image


      tar zxvf Imaging-1.1.7.tar.gz
      cd Imaging-1.1.7
      python install
      cd ..
      tar zxvf pyproj-1.8.6.tar.gz
      cd pyproj-1.8.6
      python install
      cd ..
      tar zxvf PyYAML-3.09.tar.gz
      cd PyYAML-3.09
      python install
      cd ..
      tar zxvf Jinja2-2.1.1.tar.gz
      cd Jinja2-2.1.1
      python install
      cd ..
      tar zxvf
      python install
      cd ..
      tar zxvf Paste-1.7.4.tar.gz
      cd Paste-1.7.4
      python install
      cd ..
      tar zxvf PasteDeploy-1.3.3.tar.gz
      cd PasteDeploy-1.3.3
      python install
      cd ..
      tar zxvf PasteScript-1.7.3.tar.gz
      cd PasteScript-1.7.3
      python install
      cd ..
      tar zxvf MapProxy-0.8.4.tar.gz
      cd MapProxy-0.8.4
      python install
      cd ..
      cd /home
      paster create -t mapproxy_conf mapproxy
      tar zxvf ConcurrentLogHandler-0.8.4.tar.gz
      cd ConcurrentLogHandler-0.8.4
      python install
      cd ..
      mkdir /var/www/.python-eggs
      chown www-data /var/www/.python-eggs
      vim /home/mapproxy/
      import os, sys
      from paste.script.util.logging_config import fileConfig
      BASEDIR = os.path.dirname(__file__)
      INIFILE = os.path.join(BASEDIR, 'etc', 'config.ini')
      LOGFILE = os.path.join(BASEDIR, 'etc', 'log_deploy.ini')
      os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs'
      fileConfig( LOGFILE )
      from paste.deploy import loadapp
      application = loadapp('config:%s' % INIFILE)
      vim /etc/apache2/sites-available/proxy
      <VirtualHost *:80>
        WSGIScriptAlias / /home/mapproxy/
        WSGIDaemonProcess mapproxy user=www-data group=www-data home=/home/mapproxy processes=2 maximum-requests=100
        <Location "/">
          Order deny,allow
          Allow from all
          WSGIProcessGroup mapproxy
        ErrorLog /var/log/apache2/proxy_error.log
        LogLevel warn
        CustomLog /var/log/apache2/proxy_access.log combined
      cd /etc/apache2/sites-enabled
      ln -s ../sites-available/proxy
      /etc/init.d/apache2 force-reload

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.