Last active
June 20, 2017 06:38
-
-
Save zokis/3833602 to your computer and use it in GitHub Desktop.
create_template_postgis-1.5
This file contains 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
#!/usr/bin/env bash | |
cd ~/ | |
sudo apt-get -y install python-software-properties | |
sudo /bin/sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' | |
sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get -y install postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 gdal-bin binutils libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev checkinstall libproj-dev libpq-dev | |
wget http://download.osgeo.org/postgis/source/postgis-1.5.8.tar.gz | |
tar xfvz postgis-1.5.8.tar.gz | |
cd postgis-1.5.8 | |
sudo ./configure && sudo make && sudo checkinstall --pkgname postgis-1.5.8 --pkgversion 1.5.8-src --default | |
POSTGIS_SQL_PATH=$(pg_config --sharedir)/contrib/postgis-1.5 | |
sudo su postgres -c'createdb -E UTF8 -U postgres template_postgis' | |
sudo su postgres -c'createlang -d template_postgis plpgsql;' | |
sudo su postgres -c'psql -U postgres -d template_postgis -c "CREATE EXTENSION hstore;"' | |
sudo su postgres -c'psql -U postgres -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql' | |
sudo su postgres -c'psql -U postgres -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql' | |
sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"' | |
sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"' | |
sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment