| 1 | Guide to compile and install PostGIS 2 on FreeBSD with PostgreSQL 9.2 |
| 2 | |
| 3 | [work in progress.] |
| 4 | |
| 5 | Currently there is no PostGIS2 port, so you will have to compile directly from source. |
| 6 | |
| 7 | Follow generic guide here: http://postgis.net/docs/manual-2.0/postgis_installation.html |
| 8 | |
| 9 | FreeBSD specific guide: |
| 10 | |
| 11 | Install/upgrade dependencies: |
| 12 | |
| 13 | Check PostgreSQL installed |
| 14 | |
| 15 | pkg_info | grep sql |
| 16 | |
| 17 | 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] |
| 18 | |
| 19 | pg_dumpall > dumpfilename.sql [have to be proper user] |
| 20 | |
| 21 | /usr/local/etc/rc.d/postgresql stop |
| 22 | |
| 23 | cd /usr/local/ |
| 24 | |
| 25 | mv pgsql pgsql_dump_`date +%Y%m%d%H%M` |
| 26 | |
| 27 | pkg_delete postgresql91-contrib |
| 28 | |
| 29 | pkg_delete postgresql91-client |
| 30 | |
| 31 | pkg_delete postgresql91-server |
| 32 | |
| 33 | cd /usr/ports/databases/postgresql92-server |
| 34 | |
| 35 | make install clean [config as needed] |
| 36 | |
| 37 | repeat for contrib |
| 38 | |
| 39 | [see for better instructions on upgrading: http://www.b1c1l1.com/blog/2011/01/01/upgrading-postgresql-on-freebsd/] |
| 40 | |
| 41 | Upgrade PGAdmin3 to 1.16 to work with PostgreSQL 9.2 |
| 42 | |
| 43 | Throws an error when port is compiled. I took the easy way and installed the newest PBI |
| 44 | |
| 45 | Use 'pkg_info |grep gdal' to check for gdal, proj4, and other dependencies |
| 46 | |
| 47 | Install/upgrade as required from ports |
| 48 | |
| 49 | cd /usr/ports/graphics/gdal |
| 50 | |
| 51 | make install clean |
| 52 | ....... |
| 53 | |
| 54 | Download: |
| 55 | |
| 56 | wget http://www.postgis.org/download/postgis-2.0.2.tar.gz |
| 57 | |
| 58 | tar -xvzf postgis-2.0.2.tar.gz |
| 59 | |
| 60 | cd postgis-2.0.2 |
| 61 | |
| 62 | |
| 63 | Configure: |
| 64 | |
| 65 | First got iconv.h configuration errors. Tried to link to iconv work directories - no go. Use ./configure --with-... as in provided link. |
| 66 | https://gist.github.com/4015581 |
| 67 | |
| 68 | Build |
| 69 | |
| 70 | $ make install |
| 71 | |
| 72 | Go to PGAdmin3 -> database you want the spatial extensions on -> extensions -> add new extension -> choose postgis & postgis topology |
| 73 | |
| 74 | |
| 75 | Remember to have fun! |
| 76 | |
| 77 | Peter |