Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to install Postgis 2.0 on a perfectly functionig postgresql 9.1.10 database.

I installed the package via:

richard@srv1:/$ sudo apt-get install postgresql-9.1-postgis postgis
Reading package lists... Done
Building dependency tree       
Reading state information... Done
postgis is already the newest version.
postgresql-9.1-postgis is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

With out any errors. Then I try to add postgis as an extension to an existing (empty) database, with:

 dev=# CREATE EXTENSION postgis;
 ERROR:  could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory

If I look at the location the file does not exist.

What am I missing? I can't figure it out. If I google I only get ancient results....

Where can I find the version of the installed postgis? As I'm not able to do a SELECT PostGIS_version();

Environment: Postgresql 9.1.10, Ubuntu 12.04

Update

I'm willing to install postgis2.0; apparently I have 1.5 installed. After purging that version I added the repository

deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main

After trying to install the package via

sudo apt-get update
sudo apt-get install postgis

it ends with:

Errors were encountered while processing:
/var/cache/apt/archives/libgdal1_1.9.0-3.1~pgdg12.4+1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Update 2

It appears because of the naming of the packages, it installed the wrong architecture type package. But I ended up using this website and these steps after making sure I had gdal>= 1.9.0 and GEOS >=3.3.3:

wget http://postgis.refractions.net/download/postgis-2.0.0.tar.gz
tar xfvz postgis-2.0.0.tar.gz
cd postgis-2.0.0
./configure --with-gui

make
sudo make install
sudo ldconfig
sudo make comments-install


sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/shp2pgsql
sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/pgsql2shp
sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/raster2pgsql

TADA

durham=#  select PostGIS_full_version();
NOTICE:  Function postgis_topology_scripts_installed() not found. Is topology support enabled and topology.sql installed?
                                                                     postgis_full_version                                                                     
--------------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.0.0 r9605" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.1, released 2012/05/15" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER
(1 row)
share|improve this question
    
It probably would be useful to include some information about your operating system and installation environment. Also, add appropriate tags for such. –  Get Spatial Nov 5 '13 at 21:46

2 Answers 2

up vote 5 down vote accepted

By default, you don't have PostGIS 2.0 but 1.5 (see http://packages.ubuntu.com/fr/precise/postgresql-9.1-postgis)

By doing CREATE EXTENSION postgis; you're trying to initialize from PostgreSQL with the new loading mechanism a PostGIS version (1.5) that do not support it and in this case, you will need to follow the PostGIS 1.5 official doc

If you need 2.0, follow various instructions already available in previous gis.stack.exchange.com answers e.g Install PostGIS on Ubuntu 12.04 or Can POSTGIS 2.0 be install with POSTGRES 9.2 on Ubuntu 12.04 OS at the moment?

Edit due to changes in question:

When I look in the repository (http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main), I see you can get different PostGIS versions for different PostgreSQL versions, so sudo apt-get install postgis is not enough clear for the package manager

Did you try?

sudo apt-get install postgresql-9.1-postgis-2.0
share|improve this answer
    
A so the version is the problem. I've tried to install the 2.0 version but ended up with another error. See my updated question. –  stUrb Nov 5 '13 at 22:18
    
Updated my answer –  ThomasG77 Nov 5 '13 at 22:38

You need install postgresql-9.1-postgis-scripts

In Ubuntu or Debian you need to run the following command as root:

apt-get install postgresql-9.1-postgis-scripts

This adds the files needed to create the postgis extensions

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.