-
-
Save dmeehan/6263171 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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/ | |
| #Installs postgis and postgres | |
| brew install postgis | |
| #Do it only at first start | |
| initdb /usr/local/var/postgres | |
| #Starts the database manually | |
| pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start | |
| #Creates a template to be used on creating GIS-enabled databases | |
| createdb postgis_template | |
| createlang plpgsql postgis_template | |
| #Import Postgis Data | |
| psql -d postgis_template -f /usr/local/Cellar/postgis/1.5.3/share/postgis/postgis.sql | |
| psql -d postgis_template -f /usr/local/Cellar/postgis/1.5.3/share/postgis/spatial_ref_sys.sql | |
| #Test if works | |
| psql -d postgis_template -c "SELECT postgis_full_version();" | |
| #Permissions | |
| createuser -R -S -L -D -I gisgroup; | |
| psql -d postgis_template | |
| ALTER TABLE geometry_columns OWNER TO gisgroup; | |
| ALTER TABLE spatial_ref_sys OWNER TO gisgroup; | |
| CREATE SCHEMA gis_schema AUTHORIZATION gisgroup; | |
| \q | |
| #Adds an app user | |
| createuser -i -l -S -R -d <app_user> | |
| psql -d postgres | |
| GRANT gisgroup TO <app_user>; | |
| \q | |
| #Database creation | |
| createdb -T postgis_template -O <app_user> <app_db> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment