# Some good references are: # http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x # http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/ # http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392 #1. Install PostgreSQL postgis and postgres brew install postgis initdb /usr/local/var/postgres pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start #2. Create a template to be used on creating GIS-enabled databases createdb postgis_template createlang plpgsql postgis_template #[Mac OSX] Import Postgis Data psql -d postgis_template -f /usr/local/Cellar/postgis/2.0.0/share/postgis/postgis.sql psql -d postgis_template -f /usr/local/Cellar/postgis/2.0.0/share/postgis/spatial_ref_sys.sql # If you want Raster support psql -d postgis_template -f /usr/local/Cellar/postgis/2.0.0/share/postgis/rtpostgis.sql psql -d postgis_template -f /usr/local/Cellar/postgis/2.0.0/share/postgis/topology.sql #Test if works psql -d postgis_template -c "SELECT postgis_full_version();" #3. Set template permissions to gisgroup createuser -R -S -L -D -I gisgroup; psql -d postgis_template ALTER DATABASE postgis_template OWNER TO gisgroup; ALTER TABLE geometry_columns OWNER TO gisgroup; ALTER TABLE spatial_ref_sys OWNER TO gisgroup; CREATE SCHEMA gis_schema AUTHORIZATION gisgroup; \q #4. Adds your app's user createuser -i -l -S -R -d psql -d postgres GRANT gisgroup TO ; \q #5. Create your app database createdb -T postgis_template -O ;