Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues installing PostGIS

I'm trying to install PostGIS following these instructions:

wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
tar zxvf postgis-1.5.2.tar.gz && cd postgis-1.5.2/
sudo ./configure && make && sudo checkinstall --pkgname postgis-1.5.2 --pkgversion 1.5.2-src --default

but it doesn't pass the "sudo ./configure" command. The last line it's saying:

 configure: error: could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.

So I looked online I found a place saying something like this:

--with-pgconfig=FILE PostgreSQL provides a utility called pg_config to enable extensions like PostGIS to locate the PostgreSQL installation directory. Use this parameter (--with-pgconfig=/path/to/pg_config) to manually specify a particular PostgreSQL installation that PostGIS will build against.

I searched for pg_config using " whereis pg_config" but I could not find it. Is it referring to "/etc/postgresql/9.0/main/pg_hba.conf" file or a folder....? Am I missing something? I'm really confused at this point. I guess better real confusion than false clarity :).

I'm using PostgreSQL 9 / Ubuntu 10.10. Any help would be greatly appreciated.

like image 714
avatar Avatar asked Jan 07 '11 20:01

avatar


2 Answers

You need to install geos.

But the easiest way to install is from ubuntugis-unstable repository:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update 
sudo apt-get install postgis 

If you want to compile from source you need to install:

  • postgresql-dev (from package manager)
  • libgeos-dev (from package manager or http://trac.osgeo.org/geos)
  • proj4 (from package manager or http://trac.osgeo.org/proj)
  • libxml2

If you install from package manager, also check for dev-files

I might have forgotten something but the compiler will tell.

Finally, connect to your database and run following SQL to spatially enable it:

CREATE EXTENSION postgis;

HTH

like image 137
Nicklas Avén Avatar answered Sep 27 '22 23:09

Nicklas Avén


i've testing centos 5 with postgres 9.0 i haved that problem. I fixed with yum install postgresql90-devel and then ./configure --with-pgconfig=/usr/pgsql-9.0/bin/pg_config

like image 43
Greivin Avatar answered Sep 27 '22 23:09

Greivin