Context Navigation

GeoDjango Dependencies with Apt-get on Ubuntu

The GeoDjangoInstall wiki describes in detail how to install GeoDjango dependencies from source, which for many reasons is a great approach.

However, with Ubuntu releases you can also use the Synaptic Package Manager (apt-get install on the command line) to handle some of the installation work for you. In the next version of Ubuntu (8.10), it will likely be possible to install almost everything needed using Synaptic as libraries are updated.

Note: if you take this route, be advised that the location of install directories will differ significantly from the source install approach. ie. PostGIS will be installed inside the PostgreSQL contrib and share directories specific to the PostgreSQL version number.

This writeup is based on Ubuntu 8.04 LTS. Any readers should update this document based on their experience from this version and note differences with newer versions.

Short Version

The following is a list of commands to enter into the Terminal to install GeoDjango on Ubuntu. For more detailed explanations on the installation process see the GeoDjangoInstall wiki.

Add the following to near the beginning of the settings.py file for any GeoDjango app you create:
GDAL_LIBRARY_PATH = '/usr/local/lib/libgdal.so'
Add the following to the Apache2 config file in the Location Subsection:
SetEnv GDAL_DATA /usr/local/share/

Full Instructions

Step 1

Download all needed programs and libraries using apt-get and wget [commandline] or Synaptic and Firefox [GUI]:

Synaptic or apt-get will download and install the specified packages in one step. Django and the other libraries still need to be installed as described below.

Step 2

Open up access in the pg_hba.conf file

sudo pico /etc/postgresql/8.3/main/pg_hba.conf #Alternatively use gedit or a text editor of your choice
# change ident sameuser to trust - WARNING SECURITY RISK
# comment out this line to allow, for instance, to django/psycopg2 to connect without password
local all postgres ident sameuser

Restart (or start) the server by switching into the default postgres user

sudo su - postgres
/etc/init.d/postgresql-8.3 start
exit

Step 3

Compile and install these libraries so GeoDjango can find them
Extract gdal-1.5.2.tar.gz and geos-3.0.0 to folders on your Desktop and install::