Ads 468x60px

วันพุธที่ 11 พฤษภาคม พ.ศ. 2554

Install PostgreSQL 8.4 and PostGIS 1.4.0 in Ubuntu 9.0.4


http://biodivertido.blogspot.com/2009/10/install-postgresql-84-and-postgis-140.html

WEDNESDAY, OCTOBER 21, 2009

Install PostgreSQL 8.4 and PostGIS 1.4.0 in Ubuntu 9.0.4

I am a big fan of the new PostGIS 1.4.0 (and also of Paul Ramsey) . I always have troubles installing PostGIS in ubuntu so I thought that this time I was gonna document it and blog it here. So this is just a log of the steps required to install it on an EC2 instance with Ubuntu 9.04. I hope it can be useful for someone else.

Just for the record. The EC2 instance I used was ami-ccf615 from http://alestic.com .


Once login (totally fresh).




apt-get update
apt-get install vim
#The sources are still not available on the regular package servers... edit the sources 
vim /etc/apt/sources.list
  add deb http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main
          deb-src http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8683D8A2
sudo apt-get update
sudo apt-get install postgresql-8.4
#This changes the port from 5433 to 5432
sudo sed -i.bak -e 's/port = 5433/port = 5432/' /etc/postgresql/8.4/main/postgresql.conf

sudo /etc/init.d/postgresql-8.4 stop
sudo /etc/init.d/postgresql-8.4 start
apt-get install postgresql-server-dev-8.4 libpq-dev
apt-get install libgeos-dev
wget http://postgis.refractions.net/download/postgis-1.4.0.tar.gz
apt-get install proj
tar xvfz postgis-1.4.0.tar.gz
cd postgis-1.4.0
./configure
make
make install
sudo su postgres
#change the postgres password to "atlas" so that you can later login
psql -c"ALTER user postgres WITH PASSWORD 'atlas'"

createdb geodb    (with password atlas)
createlang -dgeodb plpgsql
psql -dgeodb -f /usr/share/postgresql/8.4/contrib/postgis.sql
psql -dgeodb -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql
psql -dgeodb -c"select postgis_lib_version();"
#This should return 1.4.0
exit


Good Luck!

13 COMMENTS:


Ollie said...
Thanks. Ubuntu 9.10RC doesn't have postgis 1.4 packaged yet, so this was very useful.
nbv4 said...
psql -dgeodb -c"ALTER user postgres WITH PASSWORD 'atlas'" I don't think this line is right. the geodb isn't created yet until the next line...
Geert said...
Thanks, this was very useful!
Javier de la Torre said...
@nbv4 you are right. Just changed it
Desmond Carroll said...
This was an enormous help! Thanks very much.
geoinformation2 said...
thank you very much for this original tutorial that is the only which figure out this problem tnx :):)
Gwennie said...
This is *JUST* what I was looking for to get postgis 1.4 onto Karmic. Thank you so very much.
baa said...
Nice post! Thank you!
نلسون said...
This post has been removed by the author.
نلسون said...
thanks javier! but I reckon postgresql repo is not working anymore. adding 'deb http://archive.ubuntu.com/ubuntu jaunty-backports main universe multiverse restricted' to sources.list is not solving the problem. is there any other source for postgresql 8.4?
verapaz said...
Thank you for this orientation. It was very useful.
kehan said...
The ubuntugis ppa has compatible builds of postgis 1.5.1 for lucid #add the repository (fetches pgp keys as well) sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable #change the postgres password to "atlas" so that you can later login psql -c"ALTER user postgres WITH PASSWORD 'atlas'" createdb geodb (with password atlas) createlang -dgeodb plpgsql psql -dgeodb -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql psql -dgeodb -f psql -dgeodb -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql psql -dgeodb -c"select postgis_lib_version();" #This should return 1.5.1 exit
Javier de la Torre said...
Thanks Kehan!

0 ความคิดเห็น: