Skip to content

Instantly share code, notes, and snippets.

@omgbbqhaxx
Forked from rolo/gist:1481128
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omgbbqhaxx/9290573 to your computer and use it in GitHub Desktop.
Save omgbbqhaxx/9290573 to your computer and use it in GitHub Desktop.
#!/bin/bash
#http://postgis.net/source
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
-*-*-*-*-*-*-
sudo apt-get install libpq-dev python-dev
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install build-essential
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
pip install psycopg2
# the big list of apt dependencies to check we have installed
sudo apt-get -y install postgis postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 postgis gdal-bin binutils libgeos-3.2.2 libgeos-c1 libgeos-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall proj libpq-dev
sudo mkdir -p '/usr/share/postgresql/9.3/contrib/postgis-1.5'
# fetch, compile and install PostGIS
wget http://postgis.refractions.net/download/postgis-1.5.3.tar.gz
tar zxvf postgis-1.5.3.tar.gz && cd postgis-1.5.3/
sudo ./configure && sudo make && sudo checkinstall --pkgname postgis-1.5.3 --pkgversion 1.5.3-src --default
# now create the template_postgis database template
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 /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql'
sudo su postgres -c'psql -U postgres -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql'
sudo su postgres -c'psql -U postgres -d template_postgis -c"select postgis_lib_version();"'
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 spatial_ref_sys TO PUBLIC;"'
sudo su postgres -c'psql -U postgres -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"'
echo "Done!"
//check your psql version
JungSsi@Icodeya:~/home$ psql --version
psql (PostgreSQL) 9.2.2
//make sure to install the same version as your psql version
JungSsi@Icodeya:~/home$ sudo apt-get install postgresql-server-dev-9.2
need install xlib
apt-get install libxml2-dev libxslt-dev
apt-get install python-lxml
if you withuot gdal use :
./configure --without-raster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment