Herein lies an account of my trial and tribulations installing PostGIS on Ubuntu 10.04 Lucid.
Our story starts, as most stories do, at the beginning. PostGIS is an extension to PostgreSQL, so you must first install PostgreSQL. This is as simple as following the instructions found here: http://www.postgresql.org/download/linux/ubuntu/. This leads you through adding a new Apt repository and installing PostgreSQL from this repository. You will need to make sure you also install the postgresql-server-dev-X for the version of PostgreSQL you install. You will need this for the next step which is far more harrowing.
At this point you must ignore the siren call of the instructions at http://postgis.net/install/. The package you just installed from the PostgreSQL Apt repository does not come preinstalled with PostGIS and cannot immediately extend a database with PostGIS datatypes. Depending on the version of Ubuntu you are using, you may be able to install a prebundled PostGIS from here: http://trac.osgeo.org/ubuntugis/wiki/QuickStartGuide. For our purposes this is a wild goose chase. The only bundle available for Ubuntu 10.04 Lucid uses PostgreSQL 8.4 (as of this writing the most recent version of PostgreSQL is 9.3).
We must now go through the process of building and installing the extension from source. Instructions for this can be found here: http://postgis.net/source. For posterity I'll now relay the commands required to go from downloading the PostGIS source to installing the extension in PostgreSQL.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
wget http://download.osgeo.org/postgis/source/postgis-2.1.0.tar.gz tar -xzvf postgis-2.1.0.tar.gz |
This will download and unzip the source for PostGIS 2.1.0. Modify the above for the version you wish to install. At this point you will need to install the dependencies for PostGIS.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
apt-get install libgeos-3.1.0 libgeos-dev |
You will need to install the appropriate package for your version of Ubuntu, these can be found here: http://packages.ubuntu.com/search?keywords=geos&searchon=sourcenames&suite=all§ion=all
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
apt-get install proj libproj-dev |
This will install Proj.4.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
apt-get install gdal-bin libgdal-dev |
Finally
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
apt-get install libxml2 libxml2-dev |
With the dependencies installed you need only navigate into the postgis directory created earlier when unzipping the source and running the following commands.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
./configure make make install |
You will of course need proper permissions to modify the directories under /usr/share/postgresql/x/extension/ ..., where x is the version of PostgreSQL you installed at the beginning. You will also need to make sure to modify the permissions on 'configure' to make it executable.
And those that did not die, lived happily ever after.