giovedì 27 settembre 2012

Setup PostGIS 2.0.1 and PostgreSQL 9.1 on Ubuntu 12.04

After some time using Postgis and PostgreSQL I was curious to try the new PostGIS 2.0 discovering new features.
Thus I try to update my Ubuntu 12.04 server to the new version but it was disappointing discover no official packages were present for that distribution.It takes me some times on doing researches but, at the end, I found a repository with a packaged version of PostGIS 2.0, other than the updated libraries necessary.
So do the following steps:

$sudo apt-get install python-software-properties
$sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$sudo apt-get install postgis

Now, using the psql command line, we can connect to the Postgresql server:

$ sudo -s -u postgres
postgres$ psql
psql  (9.1.5)
postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q
postgres$

Ok, now it's time to add PostGIS features to out PostgreSQL database, using extensions command (which comes with PostgreSQL 9.1):

Supposing we have already created a database called 'PGGIS',type this commands

PGGIS=# CREATE EXTENSION postgis;
CREATE EXTENSION
PGGIS=#

Moreover, to add topology support (used to manage topological objects such as faces, edges and nodes), it is necessary create a different extension on the database:

PGGIS=# CREATE EXTENSION postgis_topology;
CREATE EXTENSION
PGGIS=#


Ok, that's all folks. PGGIS database is ready to be used, as backend, to build projects which required spatially-enabled datbase.

P.S. Pay attention not to add the

ppa:sharpie/postgis-stable  

repository and don't try to install the 

postgresql-9.1-postgis2 

package, otherwise a conflict will be raised, because the library 

/usr/lib/postgresql/9.1/lib/rtpostgis-2.0.so 

is already contained on the postgresql-9.1-postgis package
Posta un commento