Postgres and PostGIS

While working on my pet PostGIS/OpenLayers project I ran into some difficulty with PostGIS – the version I was using didn’t support export to GeoJSON, a feature that was pretty key to what I was trying to do.  Poking around, it looked like in order to upgrade to the latest version of PostGIS (1.4, as of right now) I would need to upgrade to PostgreSQL 8.4.  Attempting to do that via command line on Ubuntu 8.04 LTS proved to be a bitch, because of what appears to be a (mostly) undocumented aspect of Postgres installed through apt-get on Ubuntu systems.

Working backwards from a couple of internet walkthroughs, I uninstalled then reinstalled the postgresql-8.X, postgresql-client, and postgresql-contrib packages.  After doing so the client programs, particularly psql, were still a mess, and postgres didn’t appear to have been launched.  Manually launching it didn’t seem to work, and even Webmin couldn’t find or launch the service.  I did notice while poking around that the installation files didn’t seem to be in the same place as in the standard Postgres install documented at their site.  Finally launching a GUI package manager resolved the problem – on Ubuntu, postgres is installed by default with a package called postgresql-common, which modifies the installation directories to allow multiple instances of Postgres (8.2, 8.3, and 8.4, for example) on the same box.  Since I don’t really need that, the solution was easy – remove the postgresql-common package, then install like normal.  Worked beautifully.

Hope this saves someone the several hours of frustration it caused me.  Now to upgrade PostGIS – since the standard apt-get package for 8.04 doesn’t have GeoJSON support, it may be a frustrating adventure into the land of make/make install.

Leave a Reply