Guide to compile and install PostGIS 2 on FreeBSD with PostgreSQL 9.2
[work in progress.]
Currently there is no PostGIS2 port, so you will have to compile directly from source.
Follow generic guide here: http://postgis.net/docs/manual-2.0/postgis_installation.html
FreeBSD specific guide:
Install/upgrade dependencies:
Check PostgreSQL installed
pkg_info | grep sql
Upgrade to PostgreSQL 9.2 [not needed as long as you have >9.0, but as this is a development server, I moved to 9.2]
pg_dumpall > dumpfilename.sql [have to be proper user]
/usr/local/etc/rc.d/postgresql stop
cd /usr/local/
mv pgsql pgsql_dump_
date +%Y%m%d%H%M
pkg_delete postgresql91-contrib
pkg_delete postgresql91-client
pkg_delete postgresql91-server
cd /usr/ports/databases/postgresql92-server
make install clean [config as needed]
repeat for contrib
[see for better instructions on upgrading: http://www.b1c1l1.com/blog/2011/01/01/upgrading-postgresql-on-freebsd/]
Upgrade PGAdmin3 to 1.16 to work with PostgreSQL 9.2
Throws an error when port is compiled. I took the easy way and installed the newest PBI
Use 'pkg_info |grep gdal' to check for gdal, proj4, and other dependencies
Install/upgrade as required from ports
cd /usr/ports/graphics/gdal
make install clean .......
Download:
wget http://www.postgis.org/download/postgis-2.0.7.tar.gz
tar -xvzf postgis-2.0.7.tar.gz
cd postgis-2.0.7
Configure:
First got iconv.h configuration errors. Tried to link to iconv work directories - no go. Use ./configure --with-... as in provided link. https://gist.github.com/4015581
Build
$ make install
Go to PGAdmin3 -> database you want the spatial extensions on -> extensions -> add new extension -> choose postgis & postgis topology
Remember to have fun!
Peter