Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Script for installing Django, PostgreSQL, and PostGIS
- # Run with sudo
- # Install Django:
- apt-get install python-django python-django-doc
- # Install PostgreSQL 8.3
- apt-get install postgresql-8.3 python-psycopg2 pgadmin3
- # Packages needed by GeoDjango (gdal is optional, but useful)
- apt-get install postgresql-8.3-postgis binutils libgdal1-1.5.0 gdal-bin libgeos-3.1.0 proj libpq-dev
- # Set yourself up as a PostgreSQL superuser
- su - postgres
- createuser --createdb --superuser `whoami`
- # Create the template spatial database
- createdb -E UTF8 template_postgis
- createlang -d template_postgis plpgsql # Adding PLPGSQL language support.
- # Allows non-superusers the ability to create from this template
- psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
- # Load the PostGIS SQL routines
- psql -d template_postgis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
- psql -d template_postgis -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
- # Enable users to alter spatial tables
- psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"
- psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
- exit
- # Create database from template
- createdb -T template_postgis dbasename
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement