Skip to content

Instantly share code, notes, and snippets.

@jacobian
Created March 18, 2010 15:06
Show Gist options
  • Save jacobian/336445 to your computer and use it in GitHub Desktop.
Save jacobian/336445 to your computer and use it in GitHub Desktop.
Installing GeoDjango deps on Ubuntu 9.10
### Install some packages. Ignore the errors.
aptitude install binutils libgdal1-1.5.0 postgresql-8.3-postgis postgresql-server-dev-8.3 python-psycopg2 python-setuptools
### Make connecting to postgres easier
echo "local all all trust" > /etc/postgresql/8.3/main/pg_hba.conf
invoke-rc.d postgresql-8.3 reload
### Become the Postgres user to create a spatial template database:
sudo -u postgres -s
export POSTGIS_SQL_PATH=/usr/share/postgresql-8.3-postgis/
createdb -E UTF8 template_postgis
createlang -d template_postgis plpgsql
psql -d template_postgis -f $POSTGIS_SQL_PATH/lwpostgis.sql # Loading the PostGIS SQL routines
psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enabling users to alter spatial tables.
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
exit
### Create a database and a user for Django:
sudo -u postgres createuser geo
sudo -u postgres createdb -T template_postgis -O geo geo
### Django settings:
### DATABSE_ENGINE = 'postgresql_psycopg2'
### DATABASE_NAME = 'geo'
### DATABASE_USER = 'geo'
### If you want, installing Django Trunk:
aptitude install subversion
pip install http://code.djangoproject.com/svn/django/trunk/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment