Changes between Version 1 and Version 2 of GeoDjangoUbuntuInstall


Ignore:
Timestamp:
08/16/08 14:15:27 (7 years ago)
Author:
springmeyer
Comment:

Completed Draft Ubuntu Guide for installing GeoDjango

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjangoUbuntuInstall

    v1 v2  
    5858}}}
    5959{{{
    60 sudo apt-get install postgresql postgresql-contrib postgresql-server-dev-8.3
     60sudo apt-get install postgresql postgresql-contrib postgresql-server-dev-8.3 # or -8.2
    6161}}}
     62 * Then make sure that the postgresql programs are on your path or in .bash_profile
     63{{{
     64Export PATH=/usr/lib/postgresql/8.3/bin/
     65}}}
     66 * Open up access in the pg_hba.conf file
     67{{{
     68sudo vim /etc/postgresql/8.2/main/pg_hba.conf
     69#change ident sameuser to trust
     70# comment out this line to allow, for instance, to django/psycopg2 to connect without password
     71local   all         postgres                          ident sameuser
     72}}}
     73  * Restart the server by switching into the default user
     74{{{
     75sudo su - postgres
     76pg_ctl -o -i -D /var/lib/postgresql/8.3/main/ restart
     77}}}
     78
     79
     80=== Step 5 ===
     81Apt-get install postgis, libgdal, libgeos, and proj
     82 * Note: search for the exact package names with
     83{{{
     84apt-cache search GIS_LIB_NAME
     85}}}
     86
     87{{{
     88apt-get install postgresql-8.2-postgis libgeos-dev libgeos-c1 libgdal1-dev proj
     89}}}
     90
     91=== Step 6 ===
     92Create your PostGIS database
     93{{{
     94# Switch to the default postgres user
     95sudo su - postgres
     96# Create a template database with UTF encoding owned by the postgres user (or your user of choice)
     97createdb -E UTF8 -O postgres -U postgres template_postgis
     98# Now you can switch back to your normal user
     99exit
     100# Load the required procedural language for postgis
     101createlang plpgsql -d template_postgis -U postgres
     102# Load optional languages
     103# Load postgis functions and spatial reference info
     104# which likely was installed in the postgres share directory
     105pg_config --sharedir
     106/usr/local/pgsql/share
     107# Also look for lwpostgis.sql and spatial_ref_sys.sql in:
     108ls /usr/share/ # or /usr/local/share/
     109psql -d template_postgis -U postgres -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
     110# Note: ignore any NOTICES, like 'psql:/usr/share/lwpostgis.sql:44: NOTICE:  type "histogram2d" is not yet defined'
     111# You should see output like:
     112BEGIN
     113CREATE FUNCTION
     114CREATE OPERATOR
     115[...]
     116CREATE TYPE
     117CREATE AGGREGATE
     118COMMIT
     119# If you get an error about not being able to find  `geos` add:
     120/usr/local/lib to /etc/ld.so.conf
     121# And run:
     122ldconfig # Then restart PostgreSQL
     123# Then load the geographic projections table
     124psql -d template_postgis -U postgres -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
     125}}}
     126
     127Whoa! Hopefully that worked, and you will only have to do it once!
     128
     129From then on create a PostGIS database like:
     130{{{
     131createdb -U postgres -T template_postgis DB_NAME
     132}}}
     133
     134=== Step 7 ===
     135Return to  GeoDjangoInstall for troubleshooting and tests for GDAL and GEOS (see bottom of page)
Back to Top