| 1 | = How to install PostGIS 2.1 on Ubuntu 14.04 LTS (''trusty'') from source = |
| 2 | |
| 3 | == Prerequisites == |
| 4 | Several components are needed, which can either be built from source or installed from pre-built packages, as shown below. |
| 5 | |
| 6 | Install prerequisite packages using: |
| 7 | {{{ |
| 8 | sudo apt-get install build-essential postgresql-9.3 postgresql-server-dev-9.3 libgeos-c1 libgdal-dev libproj-dev libjson-c-dev libxml2-dev libxml2-utils xsltproc docbook-xsl docbook-mathml |
| 9 | }}} |
| 10 | |
| 11 | == Build PostGIS == |
| 12 | {{{ |
| 13 | wget http://download.osgeo.org/postgis/source/postgis-2.1.3.tar.gz |
| 14 | tar xfz postgis-2.1.3.tar.gz |
| 15 | cd postgis-2.1.3 |
| 16 | }}} |
| 17 | |
| 18 | A basic configuration for PostGIS 2.1, with raster and topology support: |
| 19 | {{{ |
| 20 | ./configure |
| 21 | make |
| 22 | sudo make install |
| 23 | sudo ldconfig |
| 24 | sudo make comments-install |
| 25 | }}} |
| 26 | |
| 27 | Lastly, enable the command-line tools to work from your shell: |
| 28 | {{{ |
| 29 | sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/shp2pgsql |
| 30 | sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/pgsql2shp |
| 31 | sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/raster2pgsql |
| 32 | }}} |
| 33 | |
| 34 | == Spatially enabling a database == |
| 35 | |
| 36 | Connect to your database using pgAdminIII or psql, and use the commands to add the PostgreSQL extensions. To add PostGIS with raster support: |
| 37 | {{{ |
| 38 | CREATE EXTENSION postgis; |
| 39 | }}} |
| 40 | |
| 41 | To add topology support, a second extension can be created on the database: |
| 42 | {{{ |
| 43 | CREATE EXTENSION postgis_topology; |
| 44 | }}} |
| 45 | |
| 46 | == See also == |
| 47 | * https://help.ubuntu.com/community/PostgreSQL |