These instructions are a draft.
Download, Build, Install PostGIS
Follow the instructions at http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS15Ubuntu1004src to retrieve, build and install version 1.5 of PostGIS.
To Build The Template
Ignore the instructions on that page. Instead:
Log directly into the postgres user using
sudo -i su - postgres
Create a database template that uses PostGIS:
createdb -E UTF-8 --locale=en_US.UTF-8 template_postgis -T template0 createlang plpgsql template_postgis psql -d template_postgis -c "UPDATE pg_database SET datistemplate=true WHERE datname='template_postgis'" psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis.sql psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis_comments.sql
Exit the postgres user:
exit exit
Note: in these instructions, the template name is template_postgis
You can choose any template name you like, but you will need to use your particular template name where appropriate when creating a database from the template.