hi phil
as you already wrote above, you need to install gcc compiler. wasn't ubuntu suposed to come with gcc installed?
anyway,
just google it and you will find good sources about ubuntu like tihs one:
http://ubuntuforums.org/archive/index.php/t-7527.html
then let us know how was pg installation! You can follow the pg installation tutorial written by Vinod.
So far, I've installed PG7.4 and PG8.1 on Madriva, Debian, and Solaris. All them worked well with the tutorial
https://openacs.org/doc/current/postgres.html