2

I am installing Postgis on my Debian server, following these instructions:

http://postgis.net/install/ (Ubuntu / Debian)

https://wiki.postgresql.org/wiki/Apt

However, after following the instructions it looks like I have installed PostGres (9.4), but no PostGIS.

Do I have to install something more that was omitted in the instructions?

Can I somehow add PostGIS as a PostGres Plugin / Extension?

  • 2
    Create extension postgis; – John Powell Jan 30 '15 at 12:15
  • FEHLER: konnte Erweiterungskontrolldatei „/usr/share/postgresql/9.4/extension/postgis.control“ nicht öffnen: Datei oder Verzeichnis nicht gefunden – Ferenjito Jan 30 '15 at 12:36
  • means something like: ERROR: could not open Extension control file "$PATH": File or Directory not found – Ferenjito Jan 30 '15 at 12:37
6

I did an extensive blog post on installing PostgreSQL 9.3/PostGIS 2.1 a few months ago at http://geospatial.commons.gc.cuny.edu/2014/10/25/installing-postgresqlpostgis-on-linux-mint-17/. It's not immediately clear to me what went wrong in your case, because you haven't really described what you did. In particular, the PostGIS installation instructions you link to describe compiling from source, as well as using the official repositories, and you don't say what you did. The fact that you are getting the message that postgis.control is missing when you try CREATE EXTENSION postgis; seems to imply that you have not successfully installed the PostGIS package. You could try

dpkg-query -l postgis

and see if it returns

ii  postgis        2.1.3+dfsg-3 i386         Geographic objects support for Po

or any other version.

If PostGIS is not in fact installed you can install from the PostgreSQL repository, which, if you have followed the directions at https://wiki.postgresql.org/wiki/Apt, is the one I believe you are using.

sudo apt-get install postgresql-9.4-postgis-2.1

Note that

sudo apt-get install postgis

should also work, but I'm not which version of PostGIS it will attempt to install since you are connected to both PostgreSQL and Ubuntu repositories, and the Ubuntu repository is still only up to PostgreSQL 9.3. So there might be a dependency issue there, but I'm not going to attempt to confirm that on my system.

Once this is installed (you can confirm by looking for /usr/share/postgresql/9.4/extension/postgis.control, the file that showed as missing before), you can proceed by logging on to PostgreSQL with a SUPERUSER account, connecting to your database (not the postgres database, your actual data database) and

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION postgis_tiger_geocoder;

Note that fuzzystrmatch (which is useful for the geocoder) requires the postgresql-contrib package.

I'm glossing over a lot here, but it's possible that I haven't correctly identified the problem, so I don't want to expand on this until I know we're on the right track. Also, please refer to my blog post above for more detail.

  • sudo apt-get install postgresql-9.4-postgis-2.1 => ` Paket postgresql-9.4-postgis-2.1 kann nicht gefunden werden E: Mittels regulärem Ausdruck »postgresql-9.4-postgis-2.1« konnte kein Paket gefunden werden` (something like Package could not been found) – Ferenjito Feb 2 '15 at 11:03
  • dpkg-query -l postgis => ........ ii postgis 1.5.1-5 geographic objects support for PostgreSQL -- common files – Ferenjito Feb 2 '15 at 11:04
  • but: Create extension postgis; within a database => FEHLER: konnte Erweiterungskontrolldatei „/usr/share/postgresql/9.4/extension/postgis.control“ nicht öffnen: Datei oder Verzeichnis nicht gefunden – Ferenjito Feb 2 '15 at 11:06
  • means something like: ERROR: could not open Extension control file "$PATH": File or Directory not found – Ferenjito Feb 2 '15 at 11:06
  • sudo apt-get install postgis worked, by the way, but it does not seem to be connected to PostGres – Ferenjito Feb 2 '15 at 11:07
1

You are installing from apt or compiling from source?

You can try:

sudo ldconfig

This will reload a few library links. This is mostly likely to happen if you installed from source.

If that still doesn't work, create a file in /etc/ld.so.conf.d/ names geos.conf and add this content to the file: /usr/local/lib (this is the address where your geos, gdal, etc, libraries are installed. if they are in a different location, change the /usr/local/lib to reflected the directory accondingly). After that, do another sudo ldconfig and try again.

Another idea: are you installing the extension using the postgres user on operation system? If not, try to use the postgres user.

1

You need to install the PostGIS extension as well, it doesn't install by default by just installing PostgreSQL.

instructions here:

http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21UbuntuPGSQL93Apt

You'll have to change a bit for 9.4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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