Simplest possible clean PostGIS install in Ubuntu Heron
Many of the pages of instructions for installing PostGIS in Ubuntu make the process seem quite complicated. Some are quite out of date.
While it is probably necessary to know a bit about the process of importing functions and languages and creating templates it is no longer necessary to get a basic PostGIS data base up and running.
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.
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 http://ppa.launchpad.net/qgis/ubuntu hardy main
Then
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.
wget http://duncanjg.files.wordpress.com/2008/09/paises.doc
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.


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
Lunken
September 24, 2008 at 8:24 am