Skip to content

Instantly share code, notes, and snippets.

@oojikoo-gist
Created July 28, 2015 06:31
Show Gist options
  • Save oojikoo-gist/6e86a6d0d135e157a8a4 to your computer and use it in GitHub Desktop.
Save oojikoo-gist/6e86a6d0d135e157a8a4 to your computer and use it in GitHub Desktop.
ubuntu: install_postgis
# 나는 이녀석을 참고했다.
# http://linfiniti.com/2012/05/installing-postgis-2-0-on-ubuntu/
#
# 환경변수에 LC_COLLATE=C 이거 있는지 확인
#1. Install PostgreSQL postgis and postgres
sudo dpkg --purge postgis postgresql-9.1-postgis
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:sharpie/for-science # To get GEOS 3.3.2
sudo apt-add-repository ppa:sharpie/postgis-nightly
sudo apt-get update
sudo apt-get install postgresql-9.1-postgis
#2. Create a template to be used on creating GIS-enabled databases
createdb -E UTF8 template_postgis2
createlang -d template_postgis2 plpgsql
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis2'"
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/postgis.sql
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/spatial_ref_sys.sql
psql -d template_postgis2 -f /usr/share/postgresql/9.1/contrib/postgis-2.1/rtpostgis.sql
psql -d template_postgis2 -c "GRANT ALL ON geometry_columns TO PUBLIC;"
psql -d template_postgis2 -c "GRANT ALL ON geography_columns TO PUBLIC;"
psql -d template_postgis2 -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
createdb training -T template_postgis2
#Test if works
psql -d template_postgis2 -c "SELECT postgis_full_version();"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment