-
-
Save rolo/1481128 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# | |
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box | |
# http://wildfish.com | |
# add the ubuntu gis ppa | |
sudo apt-get -y install python-software-properties | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update | |
# the big list of apt dependencies to check we have installed | |
sudo apt-get -y install postgis postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 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.1/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!" |
That's sure easier. Nice one - will update. Thanks.
"
ivan@ivan-Inspiron-N5110:~/postgis-1.5.3$ sudo su postgres -c'createdb -E UTF8 -U postgres template_postgis'
Password:
createdb: could not connect to database postgres: fe_sendauth: no password supplied
"
Please can you tell me what the password is , or how to found it out?
my e-mail: [email protected]
I think the script need to update pg_database table, with something like that:
sudo su postgres -c'psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"'
So, the table is marked as a template.
Thanks!!!
Incase of "ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/hstore.control": No such file or directory"
run sudo apt-get install postgresql-contrib
Thank, really this post helped me.
Unpacking postgis-1.5.3 (from .../postgis-1.5.3_1.5.3-src-1_amd64.deb) ...
dpkg: error processing /home/tspxyz/postgis-1.5.3/postgis-1.5.3_1.5.3-src-1_amd64.deb (--install):
trying to overwrite '/usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql', which is also in package postgresql-9.1-postgis 1.5.3-2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/home/tspxyz/postgis-1.5.3/postgis-1.5.3_1.5.3-src-1_amd64.deb
Hi!
Do you have libgeos-3.2.2 downloading ok?
I get an error.
Thanks!!!
THX A LOT MAN !!!!
hello rolo, in oneiric i think we have postgis 1.5.3 in the main repo:
$ apt-cache policy postgresql-9.1-postgis
postgresql-9.1-postgis:
Instalados: 1.5.3-1
Candidato: 1.5.3-2
oneiric1oneiric1 0Tabla de versión:
1.5.3-2
500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ oneiric/main amd64 Packages
*** 1.5.3-1 0
500 http://es.archive.ubuntu.com/ubuntu/ oneiric/universe amd64 Packages
100 /var/lib/dpkg/status