General

Installing PostgreSQL and PostGIS on Ubuntu Server (or Client) 9.10

Posted in General on January 8th, 2010 by Simon Connah – 1 Comment

It took me quite awhile to work out which packages where required to get the source version of PostGIS to install correctly so I thought I would write a quick blog post so I didn’t forget. I hope you find it useful.

First of all we need to install PostgreSQL 8.4. Run the following command:

sudo apt-get install postgresql libpq-dev postgresql-server-dev-8.4 proj libgeos-dev libpgtypes3 postgresql-contrib postgresql-dev postgresql-server postgresql-client

Once that command has been run you should have the correct packages installed in order to run the PostGIS configure script.

This is the standard Unix installation method and if you are not familiar with it, now is a great time to get aquatinted.

Simply run the following commands:

./configure
 
make
 
sudo make install

The documentation that I originally saw said to run the last two commands as the postgres user but obviously that results in permission denied errors as the source distribution by default installs to system directories.

That will have installed PostGIS on your system. In order to test your installation you need to run the tests that are included with the source distribution. To do this you need to chown the PostGIS source directory to be owned by the postgres user in order to give it permission to run the needed tests.

Type the following commands (where VERSION_NUMBER is the version number suffixed to the source code directory):

cd ..
 
sudo chown -R postgres:postgres postgis-VERSION_NUMBER
 
sudo su postgres
 
cd postgis-VERSION_NUMBER
 
make check

That should complete with no failures. Simply type:

exit

to return to your normal user. PostGIS is now installed and ready to use on Ubuntu Server or Client 9.10.

Feel free to leave any comments below :) .