Simplest possible clean PostGIS install in Ubuntu Heron

If these instructions are followed carefully with Ubuntu Heron, at the time of writing, you will get PostGIS running with QGIS in a few minutes.

These instructions are now out of date.

Use these to install in the latest version of Ubuntu

First place the following in your sources list either using synaptics or pasting the line at the bottom of  /etc/apt/sources.list  (sudo gedit /etc/apt/sources.list)

deb hardy main


sudo apt-get update
sudo apt-get install qgis
sudo apt-get install postgresql-8.3
sudo apt-get install postgis
sudo apt-get install postgresql-8.3-postgis
sudo apt-get install pgadmin3

One small step that is necessary is to change the user password for postgres within the database as for some reason after installing PostGIS it is no longer the default value “postgres” (Although the linux password for postgres is) . You can do this with psql. Care needed here. This has to be done correctly. The following line gets you into psql.

sudo -u postgres psql -d template1

Type this (being very careful with quotation marks and the semicolon).

alter user postgres with password ‘postgres’;

If successul you get a message saying ALTER ROLE (If there is any problem here then retype the single quotation marks to make sure they are simple. WordPress keeps changing them for some reason if they are not in an HTML box).

Then exit psql with \q or control d

Now create a database

sudo -u postgres createdb gisdb

Download a small test database with the countries of the word from this site with wget. Again the file  is disguised as a word doc in order to go into the wordpress site.


Restore this database.

sudo -u postgres psql gisdb<paises.doc

Now run qgis and connect to your new PostGIS data base.

You can then experiment importing shapefiles into the database using the graphical plugin “SPIT” and looking at the structure of the database using pgadmin.

The trial database with a single countries of the world table can also be downloaded without wget by clicking here.



2 thoughts on “Simplest possible clean PostGIS install in Ubuntu Heron

  1. Nice… thanks for that tutorial… quick and easy…

    Since I’m a noob with open source GIS and especially postgresql I wonder where are the db actually stored? For backup purposes… :_)

    thanks again

  2. Very nice clear instructions.

    Where did you get the shape file for all the countries from? Is it possible to get shape files for the regions within countries?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s