This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Dave

By: a guest on Nov 1st, 2009  |  syntax: Bash  |  size: 1.25 KB  |  views: 529  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Script for installing Django, PostgreSQL, and PostGIS
  2. # Run with sudo
  3.  
  4. # Install Django:
  5. apt-get install python-django python-django-doc
  6.  
  7. # Install PostgreSQL 8.3
  8. apt-get install postgresql-8.3 python-psycopg2 pgadmin3
  9.  
  10. # Packages needed by GeoDjango (gdal is optional, but useful)
  11. apt-get install postgresql-8.3-postgis binutils libgdal1-1.5.0 gdal-bin libgeos-3.1.0 proj libpq-dev
  12.  
  13. # Set yourself up as a PostgreSQL superuser
  14. su - postgres
  15. createuser --createdb --superuser `whoami`
  16.  
  17. # Create the template spatial database
  18. createdb -E UTF8 template_postgis
  19. createlang -d template_postgis plpgsql # Adding PLPGSQL language support.
  20.  
  21. # Allows non-superusers the ability to create from this template
  22. psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
  23.  
  24. # Load the PostGIS SQL routines
  25. psql -d template_postgis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
  26. psql -d template_postgis -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
  27.  
  28. # Enable users to alter spatial tables
  29. psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"
  30. psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
  31. exit
  32.  
  33. # Create database from template
  34. createdb -T template_postgis dbasename
clone this paste RAW Paste Data