Environement setup for Linux

Before install and launch Gisgraphy, you must setup java, postgres, and postgis. it is not, properly speaking, the installation of Gisgraphy, and if you already have postgres, postgis and java installed (you needs JVM >= 1.5) , you can go directly to the gisgraphy installation guide

Install and configure java / JVM

If you already have Java installed, you can skip this section

Install Java

Open a shell and type :
sudo apt-get install sun-java6-bin sun-java6-fonts sun-java6-javadb sun-java6-jdk sun-java6-jre sun-java6-source ia32-sun-java6-bin
Valid screen (tab + OK) :

Accept the license (TAB to select 'yes' + OK) :


To see if Java is correctly installed, open a shell and type :
java -version

You should see :
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)

We will now configure the Java.

Configure Java


Open a shell and type :
sudo update-java-alternatives --set ia32-java-6-sun

You may have this message if you are on a 64 bits machine : Impossible de find alternative « /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so ". thats not important. that's because there is no applet in 64 bits.
To see if java is well configured type "ls -l /etc/alternatives/java" you should see "/usr/lib/jvm/java-6-sun/jre/bin/java"

We now need to add a JAVA_HOME environement variable :
Type "echo $JAVA_HOME" to check it is well set : /usr/lib/jvm/java-6-sun-1.6.0.06/

The JVM is now well installed

Install postgresql and postgis

If you already have Postgresql AND Postgis installed, you can skip this section

Install the debian / ubuntu package

Open a shell and type :
sudo apt-get install postgresql-8.3 postgresql-8.3-postgis

It is HIGHLY recommended to have postgis 1.3.1 or greater and postgresql-8.3 for good performances....
Those packages are availables from ubuntu hardy, it is recommended to update your ubuntu distribution if you have a lesser version

Configure Postgis

Here are the command to install a Database and init the Gisgraphy database
# create the database
psql -U YOURUSER  -h YOURIP -c  "CREATE DATABASE gisgraphy ENCODING = 'UTF8';"

#create language
createlang -U YOURUSER -h YOURIP plpgsql gisgraphy 

#create postgis function
psql -U YOURUSER -h YOURIP -d gisgraphy -f /usr/share/postgresql-YOURPOSTGRESVERSION-postgis/lwpostgis.sql
psql -U YOURUSER -h YOURIP -d gisgraphy -f /usr/share/postgresql-YOURPOSTGRESVERSION-postgis/spatial_ref_sys.sql


Where YOURUSER is a postgresql user with admin rights,YOURIP is the ip adress of your server(127.0.0.1 in most case) and YOURPOSTGRESVERSION is your postgres version (8.3 in this tutorial)
On centOs, and on other Linux/unix distributions, the path to scripts must be change from '/usr/share/' to '/usr/share/pgsql/contrib/'.
For postgres 8.4 on ubuntu lucid the files are spatial_ref_sys.sql and 'postgis.sql' and they are located in '/usr/share/postgresql/8.4/contrib/'

Configure the postgres user / password

By default the postgres user can connect to postgres with the same password as the Unix one, but we'd like that postgres ask for a password and not use the UNIX one
Tips : Install PGAdmin. It will be more user friendly than command line.

In order to know if Postgis is correctly install, open a PostgreSQL connection or PgAdmin and type :

Define Linux settings

Unix system define a maximum number of files that can be open. solr open a large number of files. to avoid message like "Too many open files" you must increase this limit. open a shell and type
sudo ulimit -n6000

that will set the maximum number of open files to 6000.
Sometimes this is not enough. and you have to edit the /etc/security/limits.conf file and add the two following lines :
* hard nofile 20000
* soft nofile 20000
Then close and re-open your unix session to take changes into account.

Type ulimit -aH in a shell to check if the value has been set

And now...

Now that you environement is setup, you can go to the Gisgraphy installation guide