Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ldlsegovia/7389724 to your computer and use it in GitHub Desktop.
Save ldlsegovia/7389724 to your computer and use it in GitHub Desktop.
Install postgress
1 - sudo apt-add-repository ppa:sharpie/for-science # To get GEOS
2 - sudo apt-get -y --force-yes install postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 gdal-bin binutils libgeos-c1 libgeos-dev libspatialite libspatialite-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall libproj0 libproj-dev libpq-dev build-essential
3 - sudo mkdir -p '/usr/share/postgresql/9.1/contrib/'
4 - cd usr/share/postgresql/9.1/contrib/
5 - wget http://postgis.refractions.net/download/postgis-2.0.2.tar.gz
6 - tar zxvf postgis-2.0.2.tar.gz && cd postgis-2.0.2
7 - ./configure --with-raster --with-topology
8 - make
9 - sudo make install
and then..
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' (en un directorio atras estan estos sql)
sudo su postgres -c'psql -U postgres -d template_postgis -f 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;"'
@emekaokoli
Copy link

Hi I tried thissudo apt-get -y --force-yes install postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1..... and got this error

and I am using ubuntu saucy 13.10

E: Unable to locate package libspatialite

@caitifty
Copy link

Change 'libspatialite' to 'libspatialite3', so the entire line reads:

sudo apt-get -y --force-yes install postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 gdal-bin binutils libgeos-c1 libgeos-dev libspatialite3 libspatialite-dev libgdal1-dev libxml2 libxml2-dev libxml2-dev checkinstall libproj0 libproj-dev libpq-dev build-essential

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment