Login Register Actian.com  

Actian Community Wiki

Navigation
Learn About
Developing With
Ingres Talk
Information
Toolbox

GeoDemoLinuxSetup

From Ingres Community Wiki

Jump to: navigation, search

Return to: Geospatial Community Project

The following instructions are to setup the Geo Spatial Demo on Linux. It is originally based on Paul Spencer's demo from the 2008 Engineering Summit.

Contents

Required Packages

These packages may or may not be available from your platforms Software Manager. The versions listed are the minimum versions required as of May 2008. The order does not matter, as the software manager should handle the dependencies.

   * libstdc++ version 6.0.9.
   * libjpeg and libjpeg-devel version 6b.
   * jpeg-devel 6b
   * tiff version 3.8.2.
   * pdflib_lite version 6.0.3.
   * libpng and libpng-devel version 1.2.8.
   * freetype and freetype-devel version 2.1.9.
   * gd version and gd-devel 2.0.35.
   * openssl version 0.9.8a.
   * curl version 7.17.1.
   * proj and proj-devel version 4.5.0.
   * libgeotiff version 1.2.4.
   * xerces_c version 2_6_0.
   * libungif version 4.1.3.
   * expat version 1.95.8.
   * apache version 1.3.39.
   * libxml2 version 2.6.19.
   * python version 2.3.0.
   * agg version 2.4.
   * php and php-devel and php-xml version 5.2.9.2
   * libtool 2.2.6

Source Packages Required

The following applications will be downloaded and compiled from source code.

Important points to remember:

  • Start these installs after the "Required Packages" have been installed.
  • For these packages, the order DOES matter.
  • The packages can be unzipped and untar'd in any convenient development directory; it does not impact the install.
  • The configure and make commands listed are run from within the directory that is created when extracting from the tar or checking out from SVN.
  • After the Ingres install, ensure that the proper .ingXXbash file is sourced when configuring and compiling the other packages, many of them refer to $II_SYSTEM or require the Ingres libraries in the $LD_LIBRARY_PATH variable.

GEOS

Note: Currently the Ingres spatial branch includes a patch which must be applied to GEOS trunk in order for Ingres to build correctly.

Website http://trac.osgeo.org/geos
Download http://download.osgeo.org/geos/
Configure ./configure
Compile make
Install make install

Ingres Install with New Spatial Library

  • Pull the Ingres code from the SVN repository at http://code.ingres.com/ingres/branches/geospatial
  • Run the runbuild.sh script in the root of the project
  • After it completes without errors run buildtools/createdbms
  • Install Ingres properly using release/ingres-somerelease/ingres_express_install

GDAL / OGR

The Geospatial Data Abstraction Library (GDAL/OGR) is a translator library for raster and vector geospatial data formats.

Website http://www.gdal.org
Download svn co https://svn.osgeo.org/gdal/trunk/gdal gdal
Configure ./configure --with-ingres=$II_SYSTEM --with-geos=yes --with-libtiff=internal
Compile make
Install make install

MapServer

MapServer was started at the University of Minnesota and is now part of OSGEO. It is a open source development environment for building spatially-enabled web mapping applications and services.

This demo is built on MapServer version 5.4.2. The fusion version in the demo package and the svn version of MapServer won't work together.

Website http://mapserver.org/
Download Version 5.4.2
SVN svn co https://svn.osgeo.org/mapserver/trunk/mapserver mapserver
Configure ./configure --with-geos=/usr/local/bin/geos-config --with-gdal=/usr/local/bin/gdal-config --with-ogr --with-gd=/usr --with-libiconv=/usr/local --with-png=/usr --with-proj --with-php=/usr/include/php --with-freetype --with-regex=system
Compile make
Install cp mapserv /var/www/cgi-bin/

Using --with-tiff appears to break the bath_mapserver.tif file.

References: How to configure and compile: http://mapserver.gis.umn.edu/docs/howto/compiling_on_unix New users guide: http://mapserver.gis.umn.edu/new_users

Prepare the Database

This step covers creating the Ingres database and apache user.

Create the database for the Spatial data. In this example, the Ingres instance is "II", the user created is "ingres", and the database name is "geo".

[####@localhost ~/]$ su - ingres
Password: 
[ingres@localhost ~]$ source ~/.ingIIbash
[ingres@localhost ~]$ createdb geo

As ingres user, create user apache or http, depending on what user the Apache web server runs as, and grant permissions to that user on the tables in question. We are assuming user apache:

$ sql iidbdb
* create user apache with privileges = (createdb, security)\g
* \q

Ubuntu Specific Web Server Setup

  • adduser apache
  • put . /home/.ingIIsh in /etc/apache2/envvars
  • change user and group to apache from www-data in envvars
  • put PassEnv II_SYSTEM LD_LIBRARY_PATH in /etc/apache2/httpd.conf
  • put ServerName localhost in /etc/apache2/httpd.conf (make sure this is mapped to 127.0.0.1 in /etc/hosts)
  • from mapserver cp mapserv to /usr/lib/cgi-bin
  • from mapserver cp mapscript/php3/php_mapscript.so to /usr/lib/php5/20060613/ (could be slightly different from 20060613, saw 20060613+lfs
  • add php_mapscript.so to /etc/php5/conf.d/php_mapscript.ini
  • download demo_package.tgz to /var/www and run tar xvzf in the same directory
  • cd to /var/www/gmap-ms46/data and run load.sh (you will need to have Ingres running, .ingIIsh sourced and apache user created inside Ingres)
  • Mapserver/Fusion should now load if you navigate to http://localhost/demo

Fedora Core 11 Specific Web Server Setup

Need to be root.

  • Copy the Ingres environment setup to a spot where apache can 'see' it. cp ~ingres/.ingIIsh /var/www/.
  • source /var/www/.ingIIsh to setup the Ingres environment variables.
  • Copy from mapserver location mapscript/php3/php_mapscript.so to /usr/lib/php/modules/.
  • Create /etc/ld.so.conf.d/ingres.conf with the line /opt/Ingres/IngresII/ingres/lib and run ldconfig
  • Fix SE Linux errors by disabling it. Edit /etc/selinux/config and change:
   SELINUX=enforcing

to

   SELINUX=permissive
  • Change apache to use /var/www as document root. Edit /etc/httpd/conf/httpd.conf and change
   DocumentRoot=/var/www/html

to

   DocumentRoot=/var/www

and

   <Directory "/var/www/html">

to

   <Directory "/var/www">

Add

   PassEnv II_SYSTEM LD_LIBRARY_PATH 

to the Global Environment settings. then restart apache

   apachectl restart
  • download demo_package.tgz to /var/www and run tar xvzf in the same directory
  • cd to /var/www/gmap-ms46/data and run load.sh (you will need to have Ingres running, .ingIIsh sourced and apache user created inside Ingres)
  • Mapserver/Fusion should now load if you navigate to http://localhost/demo

Retrieve the Data

Sample data is available from many sources. In this scenario, shape files were used. The tool ogr2ogr converted the shape files and imported them into tables in the Ingres database. A copy of this data is packaged with the demo_package.tgz file.

Sample data:

   * http://dl.maptools.org/dl/gmap-ms46.tar.gz

Commands used to load data

The load.sh script will do the following commands for every shape file included in the package. The commands are listed here for easy reference.

Because gdal was built from svn trunk with the --with-ingres=$II_SYSTEM option, we can use a command like this on any shape file and it will be imported into an Ingres table, in the "geo" database:

ogr2ogr -overwrite -f ingres @driver=ingres,dbname=geo road.shp

The name of the new Ingres table is "road", taken from the shape file name.

Perform the "grant" command for each table required. Table names can be retrieved by:

$ sql geo
* help \g
$ sql geo
* grant all on <table-name> to user apache; \g

Ingres Install with Old Spatial Library

For historical purposes this was the old Spatial add-on.

This must contain the old Spatial library, which is now available from version 9.2.0.

To download Ingres: http://esd.ingres.com

Once Ingres is installed, run the command:

iilink

Then start the database with:

ingstart
Personal tools
© 2011 Actian Corporation. All Rights Reserved