SlideShare a Scribd company logo
Installing
Postgres & Postgis
Mostly on a Mac,
but also on Linux
& Windows
John Ashmead
Why?
•Building a mapping website!
•Wanted Postgres 9.2 to go pure

Javascript: client, server (node.js), &
database!!

•And wanted latest & greatest mapping
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Objective
•Postgres 9.2!
•Postgis 2.0 http://www.postgis.org/!
•psql, pgAdmin3, & phpPgAdmin!
•Node.js!
•PL/Javascript
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Stack Builder

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Strategies
•EnterpriseDB - provides Stack Builder

not currently current, but good starting
point!

•DMGs - not always current, but good
intel!

•Open source: fink, homebrew,

macports - can be hacked, instructive

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
EnterpriseDB

% sudo vi /etc/sysctl.conf
!
On a MacBook Pro with 2GB of RAM, the author's sysctl.conf contains:
!
kern.sysv.shmmax=1610612736
kern.sysv.shmall=393216
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.maxprocperuid=512
kern.maxproc=2048
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Kyngchaos
•Stackbuilder!
•Not quite current: when did first, was
Postgres 9.1, PostGIS 1.5. (Now is 9.1,
but 2.0.0)!

•But lots of good information, i.e.

PostGIS has lots of dependencies: geos,
proj4, some others

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Xcode

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Open source
packagers
•Fink - precompiled binaries preferred. Not
as up to date. Not current enough.!

•Homebrew - easier to use. On github. Uses
ruby. Less intrusive. Assumes single user.!

•Macports - tends to pull a lot of stuff down.
Possibly more general. Used here. http://
www.macports.org/

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Portfiles
https://trac.macports.org/browser/trunk/dports/databases/
postgis2/Portfile
variant postgresql92
description {Builds with postgresql
9.2} 
conflicts postgresql90 postgresql91 {
depends_lib-append
port:postgresql92
archcheck.files-append lib/postgresql92/libpq.dylib
configure.args-append
--libdir=${prefix}/lib/postgresql92
--with-pgconfig=${prefix}/lib/
postgresql92/bin/pg_config
build.args-append
PGSQL_DOCDIR=${destroot}${prefix}/
share/doc/postgresql91
PGSQL_MANDIR=${destroot}${prefix}/
share/man
}
!

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Port commands
port list > /dev/null
Warning: port definitions are more than two weeks old, consider
using selfupdate
port selfupdate
[ port upgrade postgresql92 skipped ]
port -v install postgresql91 +perl +tcl +python
port -v install postgresql91-doc
port install pgAdmin3 +postgresql91 +with_postgresql91
port install postgis2 +postgresql91 +raster +gui +topology

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Daemondo
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/daemondo</string>
<string>--label=vm-pop3d</string>
<string>--start-cmd</string>
<string>/opt/local/sbin/vm-pop3d</string>
<string>-d</string>
<string>10</string>
<string>-t</string>
<string>600</string>
<string>;</string>
</array>

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Launch Daemons

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Processes
507 7714
1
0 5:22PM ??
0:00.04 /Library/
PostgreSQL/9.2/bin/postmaster -D/Library/PostgreSQL/9.2/data
507 7715 7714
0 5:22PM ??
0:00.00 postgres: logger
process
507 7717 7714
0 5:22PM ??
0:00.01 postgres:
checkpointer process
507 7718 7714
0 5:22PM ??
0:00.05 postgres: writer
process
507 7719 7714
0 5:22PM ??
0:00.03 postgres: wal
writer process
507 7720 7714
0 5:22PM ??
0:00.05 postgres:
autovacuum launcher process
507 7721 7714
0 5:22PM ??
0:00.07 postgres: stats
collector process
~

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Profile variables
vi .profile
# to change back to Postgres 9.1, fix path & set PGPORT to 5432,
export PATH=".:/opt/local/lib/postgresql92/bin:/Library/
PostgreSQL/9.2/bin:$PATH”
!
export PGDATABASE=talkinvite
export PGUSER=talkinvite
export PGPORT=5433
vi apache/conf/httpd.conf
#
ServerRoot "/Library/PostgreSQL/EnterpriseDB-ApachePHP/apache"
# Listen: Allows you to bind Apache to specific IP addresses and/
#
Listen 8081
vi phpPgAdmin/conf/config.inc.php
# to change back to Postgres 9.1, fix path & set PGPORT to 5432,
// Database port on server (5432 is the PostgreSQL default)
// Using 5433 for Postgres 9.2
$conf['servers'][0]['port'] = 5433;
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Verify
•Check psql, pgAgent3, pgPhpAdmin
(using apache)!

•Bounce box, make sure it comes back!
•Hand save some simple maps, then
recover

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Linux/Parallels

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Pre-Requisites
for PostGIS
•Obvious ones (database, compiler, …)!
•PROJ4 - makes round things flat!
•GEOS - “fairly safe to upgrade”!
•LibXML2 - what may have broken!
•JSON-C - JSON support for GEO!
•GDAL - raster support
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Of the 36 strategies,
running away is the best
•Loaded in Postgres 9.1, PostGIS 1.5!
•Tried upgrade to postGIS 2.0 using
various tricks on web. Kept hitting
failures, missing bits & so on, dead
parrots from previous runs, !

•Ask Bruce & Jim
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Windows/
VMWare

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Download latest

Fixed www/phppgadmin/conf/config.inc.php to use port 5433
Ran “select

version()”

to get:

select postgis_full_version()

->
POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel.
4.8.0, 6 March 2012" GDAL="GDAL 1.9.1, released 2012/05/15"
LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Node.js

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Fun with maps
•
•
•
MVC & mapping libraries
•
A plan, ney, a map
•

PostGIS
Javascript & node
Open source maps - MapServer, PostGIS

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Checklist
•Software downloads: node, npm, express, … !
•Setup hackable app: my what lovely stack traces
we are showing today…!

•Verify hackable’s access to postgres!
•Find & load in initial spatial data!
•Manage spatial data (leaflet)!
•Create MVC wrappers for all this GIS goodness

Installing Postgres & PostGIS on a Mac - November 20th, 2012

http://www.ashmeadsoftware.com
Recommendations
(your mileage may vary)
•Go with packages,

defaults when you can!

•If you can’t, build up in
layers.!

•Trust but verify!
•Learn a bit more than

you need to; ask around!

Installing Postgres & PostGIS on a Mac - November 20th, 2012

•Keep a log

http://www.ashmeadsoftware.com

More Related Content

What's hot (20)

PDF
Group Replication in MySQL 8.0 ( A Walk Through )
Mydbops
 
PDF
What is new in MariaDB 10.6?
Mydbops
 
PPTX
MySQL Utilities -- Cool Tools For You: PHP World Nov 16 2016
Dave Stokes
 
PDF
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
mCloud
 
PPTX
Postgresql
NexThoughts Technologies
 
PDF
Mongodb replication
PoguttuezhiniVP
 
PDF
Evolution of MongoDB Replicaset and Its Best Practices
Mydbops
 
PDF
Migrating to postgresql
botsplash.com
 
PDF
Evolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops Team
Mydbops
 
PDF
MySQL database replication
PoguttuezhiniVP
 
PDF
What is new in PostgreSQL 14?
Mydbops
 
PPTX
PostgreSQL Database Slides
metsarin
 
KEY
Cassandra and Rails at LA NoSQL Meetup
Michael Wynholds
 
PDF
Postgresql tutorial
Ashoka Vanjare
 
ODP
Drupal MySQL Cluster
Kris Buytaert
 
PDF
What's New in PostgreSQL 9.6
EDB
 
PPTX
Understanding and tuning WiredTiger, the new high performance database engine...
Ontico
 
PDF
InnoDB Performance Optimisation
Mydbops
 
PDF
What’s New In PostgreSQL 9.3
Pavan Deolasee
 
PDF
InnoDB Cluster Experience (MySQL User Camp)
Mydbops
 
Group Replication in MySQL 8.0 ( A Walk Through )
Mydbops
 
What is new in MariaDB 10.6?
Mydbops
 
MySQL Utilities -- Cool Tools For You: PHP World Nov 16 2016
Dave Stokes
 
Developers’ mDay 2021: Bogdan Kecman, Oracle – MySQL nekad i sad
mCloud
 
Mongodb replication
PoguttuezhiniVP
 
Evolution of MongoDB Replicaset and Its Best Practices
Mydbops
 
Migrating to postgresql
botsplash.com
 
Evolution of MonogDB Sharding and Its Best Practices - Ranjith A - Mydbops Team
Mydbops
 
MySQL database replication
PoguttuezhiniVP
 
What is new in PostgreSQL 14?
Mydbops
 
PostgreSQL Database Slides
metsarin
 
Cassandra and Rails at LA NoSQL Meetup
Michael Wynholds
 
Postgresql tutorial
Ashoka Vanjare
 
Drupal MySQL Cluster
Kris Buytaert
 
What's New in PostgreSQL 9.6
EDB
 
Understanding and tuning WiredTiger, the new high performance database engine...
Ontico
 
InnoDB Performance Optimisation
Mydbops
 
What’s New In PostgreSQL 9.3
Pavan Deolasee
 
InnoDB Cluster Experience (MySQL User Camp)
Mydbops
 

Similar to Installing postgres & postgis (20)

PDF
Building Location Aware Apps - Get Started with PostGIS, PART I
lasmasi
 
PDF
Pg intro part1-theory_slides
lasmasi
 
PDF
Postgresql quick guide
Ashoka Vanjare
 
PDF
Postgres database Ibrahem Batta
Ibrahem Batta
 
PDF
9 steps to install and configure postgre sql from source on linux
chinkshady
 
PPTX
PostGIS_intro.pptx
RaguRaguNan1
 
PPTX
FOSS4G 2017 Spatial Sql for Rookies
Todd Barr
 
PDF
Leicester 2010 notes
Joanne Cook
 
PDF
Discover PostGIS: Add Spatial functions to PostgreSQL
EDB
 
PDF
Getting Started with PostGIS
EDB
 
PPT
Open Source GIS
Joe Larson
 
PDF
Osgis 2010 notes
Joanne Cook
 
PDF
0292-introduction-postgresql.pdf
Mustafa Keskin
 
PDF
Get to know PostgreSQL!
Oddbjørn Steffensen
 
PDF
Post gispguk
lbtlsystems
 
PPTX
Easy Installation and Setup of PostgreSQL on Linux, OSX, & Windows
haroonm
 
PDF
2010 13.guide de_la_programmation_avec_qgis_1.5_extensions_et_applications_pr...
Eduardo Nuno
 
PPTX
PostGIS and Spatial SQL
Todd Barr
 
PDF
Lancaster University GIS Course 2010
Joanne Cook
 
PPTX
I ♥ Maps: Quantum GIS + Python
Paige Bailey
 
Building Location Aware Apps - Get Started with PostGIS, PART I
lasmasi
 
Pg intro part1-theory_slides
lasmasi
 
Postgresql quick guide
Ashoka Vanjare
 
Postgres database Ibrahem Batta
Ibrahem Batta
 
9 steps to install and configure postgre sql from source on linux
chinkshady
 
PostGIS_intro.pptx
RaguRaguNan1
 
FOSS4G 2017 Spatial Sql for Rookies
Todd Barr
 
Leicester 2010 notes
Joanne Cook
 
Discover PostGIS: Add Spatial functions to PostgreSQL
EDB
 
Getting Started with PostGIS
EDB
 
Open Source GIS
Joe Larson
 
Osgis 2010 notes
Joanne Cook
 
0292-introduction-postgresql.pdf
Mustafa Keskin
 
Get to know PostgreSQL!
Oddbjørn Steffensen
 
Post gispguk
lbtlsystems
 
Easy Installation and Setup of PostgreSQL on Linux, OSX, & Windows
haroonm
 
2010 13.guide de_la_programmation_avec_qgis_1.5_extensions_et_applications_pr...
Eduardo Nuno
 
PostGIS and Spatial SQL
Todd Barr
 
Lancaster University GIS Course 2010
Joanne Cook
 
I ♥ Maps: Quantum GIS + Python
Paige Bailey
 
Ad

More from John Ashmead (20)

PDF
The Quantum Internet: Hype or the Next Step
John Ashmead
 
PDF
How to build a PostgreSQL-backed website quickly
John Ashmead
 
PDF
The Quantum Internet: Hype or the Next Step
John Ashmead
 
PDF
Artificial Intelligence: Past, Present, Futures
John Ashmead
 
PDF
Time dispersion in time-of-arrival measurements
John Ashmead
 
PDF
Time dispersion in quantum mechanics -- Philcon 2019 version
John Ashmead
 
PDF
Time dispersion in quantum mechanics
John Ashmead
 
PDF
Mars Or Bust!
John Ashmead
 
PDF
Practical Telepathy: The Science & Engineering of Mind-Reading
John Ashmead
 
PDF
From Startup to Mature Company: PostgreSQL Tips and techniques
John Ashmead
 
PDF
Practical Telepathy: The Science & Engineering of Mind-Reading
John Ashmead
 
PDF
Stargates: Theory and Practice
John Ashmead
 
PDF
StarGates: Theory and Practice
John Ashmead
 
PDF
Quantum dots
John Ashmead
 
PDF
Star Gates: the Theory and Practice
John Ashmead
 
PDF
Time to the power of Tim
John Ashmead
 
PDF
How many universes are there, anyway
John Ashmead
 
PPTX
A Quantum of Mystery
John Ashmead
 
PDF
Converting from MySQL to PostgreSQL
John Ashmead
 
PDF
Seven War Stories and a Moral
John Ashmead
 
The Quantum Internet: Hype or the Next Step
John Ashmead
 
How to build a PostgreSQL-backed website quickly
John Ashmead
 
The Quantum Internet: Hype or the Next Step
John Ashmead
 
Artificial Intelligence: Past, Present, Futures
John Ashmead
 
Time dispersion in time-of-arrival measurements
John Ashmead
 
Time dispersion in quantum mechanics -- Philcon 2019 version
John Ashmead
 
Time dispersion in quantum mechanics
John Ashmead
 
Mars Or Bust!
John Ashmead
 
Practical Telepathy: The Science & Engineering of Mind-Reading
John Ashmead
 
From Startup to Mature Company: PostgreSQL Tips and techniques
John Ashmead
 
Practical Telepathy: The Science & Engineering of Mind-Reading
John Ashmead
 
Stargates: Theory and Practice
John Ashmead
 
StarGates: Theory and Practice
John Ashmead
 
Quantum dots
John Ashmead
 
Star Gates: the Theory and Practice
John Ashmead
 
Time to the power of Tim
John Ashmead
 
How many universes are there, anyway
John Ashmead
 
A Quantum of Mystery
John Ashmead
 
Converting from MySQL to PostgreSQL
John Ashmead
 
Seven War Stories and a Moral
John Ashmead
 
Ad

Recently uploaded (9)

PPTX
Understanding Emotional Intelligence: A Comprehensive Overview
siddharthjaan
 
PDF
ExpoGestão 2025 - Networking – O Poder das Conexões Humanas
ExpoGestão
 
PPTX
Remote_Work_Productivity_Strategies.pptx
MuhammadUzair504018
 
PPTX
LESSON 1 IN PHILOSOPHY- INTRODUCTION TO PHILOSOPHY
MaimaiAlleraAcpal
 
PDF
The Story of Al-Fitra by Mr. Saidi Adam Younes
ademyounessaidi
 
PPTX
AAM - NQAS Orientation CHALLANGES & SOLUTION 24 & 25 FEB24.pptx
minikashyap9528
 
PPTX
Free Preparation and Survival Apps that can save your life
Bob Mayer
 
PPTX
Impact_of_Power_Outages_Presentation.pptx
mansisingh27077
 
PDF
UCSP-Quarter1_M5.pdf POLITICS AND POLITICL
jaredcagampan86
 
Understanding Emotional Intelligence: A Comprehensive Overview
siddharthjaan
 
ExpoGestão 2025 - Networking – O Poder das Conexões Humanas
ExpoGestão
 
Remote_Work_Productivity_Strategies.pptx
MuhammadUzair504018
 
LESSON 1 IN PHILOSOPHY- INTRODUCTION TO PHILOSOPHY
MaimaiAlleraAcpal
 
The Story of Al-Fitra by Mr. Saidi Adam Younes
ademyounessaidi
 
AAM - NQAS Orientation CHALLANGES & SOLUTION 24 & 25 FEB24.pptx
minikashyap9528
 
Free Preparation and Survival Apps that can save your life
Bob Mayer
 
Impact_of_Power_Outages_Presentation.pptx
mansisingh27077
 
UCSP-Quarter1_M5.pdf POLITICS AND POLITICL
jaredcagampan86
 

Installing postgres & postgis

  • 1. Installing Postgres & Postgis Mostly on a Mac, but also on Linux & Windows John Ashmead
  • 2. Why? •Building a mapping website! •Wanted Postgres 9.2 to go pure Javascript: client, server (node.js), & database!! •And wanted latest & greatest mapping Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 3. Objective •Postgres 9.2! •Postgis 2.0 http://www.postgis.org/! •psql, pgAdmin3, & phpPgAdmin! •Node.js! •PL/Javascript Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 4. Stack Builder Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 5. Strategies •EnterpriseDB - provides Stack Builder not currently current, but good starting point! •DMGs - not always current, but good intel! •Open source: fink, homebrew, macports - can be hacked, instructive Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 6. EnterpriseDB % sudo vi /etc/sysctl.conf ! On a MacBook Pro with 2GB of RAM, the author's sysctl.conf contains: ! kern.sysv.shmmax=1610612736 kern.sysv.shmall=393216 kern.sysv.shmmin=1 kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.maxprocperuid=512 kern.maxproc=2048 Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 7. Kyngchaos •Stackbuilder! •Not quite current: when did first, was Postgres 9.1, PostGIS 1.5. (Now is 9.1, but 2.0.0)! •But lots of good information, i.e. PostGIS has lots of dependencies: geos, proj4, some others Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 8. Xcode Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 9. Open source packagers •Fink - precompiled binaries preferred. Not as up to date. Not current enough.! •Homebrew - easier to use. On github. Uses ruby. Less intrusive. Assumes single user.! •Macports - tends to pull a lot of stuff down. Possibly more general. Used here. http:// www.macports.org/ Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 10. Portfiles https://trac.macports.org/browser/trunk/dports/databases/ postgis2/Portfile variant postgresql92 description {Builds with postgresql 9.2} conflicts postgresql90 postgresql91 { depends_lib-append port:postgresql92 archcheck.files-append lib/postgresql92/libpq.dylib configure.args-append --libdir=${prefix}/lib/postgresql92 --with-pgconfig=${prefix}/lib/ postgresql92/bin/pg_config build.args-append PGSQL_DOCDIR=${destroot}${prefix}/ share/doc/postgresql91 PGSQL_MANDIR=${destroot}${prefix}/ share/man } ! Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 11. Port commands port list > /dev/null Warning: port definitions are more than two weeks old, consider using selfupdate port selfupdate [ port upgrade postgresql92 skipped ] port -v install postgresql91 +perl +tcl +python port -v install postgresql91-doc port install pgAdmin3 +postgresql91 +with_postgresql91 port install postgis2 +postgresql91 +raster +gui +topology Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 13. Launch Daemons Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 14. Processes 507 7714 1 0 5:22PM ?? 0:00.04 /Library/ PostgreSQL/9.2/bin/postmaster -D/Library/PostgreSQL/9.2/data 507 7715 7714 0 5:22PM ?? 0:00.00 postgres: logger process 507 7717 7714 0 5:22PM ?? 0:00.01 postgres: checkpointer process 507 7718 7714 0 5:22PM ?? 0:00.05 postgres: writer process 507 7719 7714 0 5:22PM ?? 0:00.03 postgres: wal writer process 507 7720 7714 0 5:22PM ?? 0:00.05 postgres: autovacuum launcher process 507 7721 7714 0 5:22PM ?? 0:00.07 postgres: stats collector process ~ Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 15. Profile variables vi .profile # to change back to Postgres 9.1, fix path & set PGPORT to 5432, export PATH=".:/opt/local/lib/postgresql92/bin:/Library/ PostgreSQL/9.2/bin:$PATH” ! export PGDATABASE=talkinvite export PGUSER=talkinvite export PGPORT=5433 vi apache/conf/httpd.conf # ServerRoot "/Library/PostgreSQL/EnterpriseDB-ApachePHP/apache" # Listen: Allows you to bind Apache to specific IP addresses and/ # Listen 8081 vi phpPgAdmin/conf/config.inc.php # to change back to Postgres 9.1, fix path & set PGPORT to 5432, // Database port on server (5432 is the PostgreSQL default) // Using 5433 for Postgres 9.2 $conf['servers'][0]['port'] = 5433; Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 16. Verify •Check psql, pgAgent3, pgPhpAdmin (using apache)! •Bounce box, make sure it comes back! •Hand save some simple maps, then recover Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 17. Linux/Parallels Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 18. Pre-Requisites for PostGIS •Obvious ones (database, compiler, …)! •PROJ4 - makes round things flat! •GEOS - “fairly safe to upgrade”! •LibXML2 - what may have broken! •JSON-C - JSON support for GEO! •GDAL - raster support Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 19. Of the 36 strategies, running away is the best •Loaded in Postgres 9.1, PostGIS 1.5! •Tried upgrade to postGIS 2.0 using various tricks on web. Kept hitting failures, missing bits & so on, dead parrots from previous runs, ! •Ask Bruce & Jim Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 20. Windows/ VMWare Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 21. Download latest Fixed www/phppgadmin/conf/config.inc.php to use port 5433 Ran “select version()” to get: select postgis_full_version() -> POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.1, released 2012/05/15" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 22. Node.js Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 23. Fun with maps • • • MVC & mapping libraries • A plan, ney, a map • PostGIS Javascript & node Open source maps - MapServer, PostGIS Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 24. Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 25. Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 26. Checklist •Software downloads: node, npm, express, … ! •Setup hackable app: my what lovely stack traces we are showing today…! •Verify hackable’s access to postgres! •Find & load in initial spatial data! •Manage spatial data (leaflet)! •Create MVC wrappers for all this GIS goodness Installing Postgres & PostGIS on a Mac - November 20th, 2012 http://www.ashmeadsoftware.com
  • 27. Recommendations (your mileage may vary) •Go with packages, defaults when you can! •If you can’t, build up in layers.! •Trust but verify! •Learn a bit more than you need to; ask around! Installing Postgres & PostGIS on a Mac - November 20th, 2012 •Keep a log http://www.ashmeadsoftware.com

Editor's Notes

  • #2: \n
  • #3: \n
  • #4: \n
  • #5: Had a first pass, spent quite a few hours working this out, got up to 9.1 + 2.0.1\n\nFor this talk, walked up to 9.2, checked what status is now\n\nExpert on UNIX sysadm &amp; databases, but not on postgres\n
  • #6: As to databases, have used a lot. \nFor open source, have like violins: SQLite, MySQL, Postgres\nPostgres 9.2 has JS internally, so with node.js can run js on client, server, &amp; database. Sweet.\n20\nHad previously installed 9.1. On an iMac with 20GB memory.\n
  • #7: No postgis extension!\nTried copying the postgis-2.0 to /Library/PostgreSQL/9.2/lib, didn&amp;#x2019;t help\nUsed pg_config to figure out that $libdir was /Library/PostgreSQL/9.2/lib\nIs server needed for 9.2?\nWhy can&amp;#x2019;t it find postgis-2.0 in $libdir when it is there\n\n\n\n
  • #8: \n
  • #9: \n
  • #10: There are lots postGIS dependences listed there:\n\n
  • #11: \n
  • #12: http://tedwise.com/2010/08/28/homebrew-vs-macports/\n\nFink puts stuff in /sw; have used a lot; didn&apos;t want to talk to me just now: pdb.finkproject.org\n\nthere is also http://www.pkgsrc.org/\n\n\n\n\n\n\n\n
  • #13: \n
  • #14: Problem is that it doesn&amp;#x2019;t hook stuff up, so have to have apache setup, launchd, and so on.\nFortunately enterprisedb does all this\n\n7412 lines later on the postgis2 upgrade! :)\n\nInstalls files in /opt/local/var/macports and various sub directories of this\n\nNow at 9.1 + 2.0.1, want to go to 9.2 + 2.0.1!\n-- so we have javascript!\n\n \n\n\n\n\n
  • #15: \n
  • #16: Port installs a program called daemondo wrappers the package in a way that works well with mac&apos;s launchd.\n\nNot needed for postgres since there is only one command, portmaster, to be run\n\nnot needed for postgis, since that installs as an extension within postgres\n\nso replaced call to daemondo with direct call on postmaster, less kruft\n\non first install, use port install package name, on subsequent should use port upgrade package name(s)\n\n\n\n\n\n\n
  • #17: \n
  • #18: \n
  • #19: \n
  • #20: Ubuntu software center &amp; postgres\n\napparnetly you have to sudo to run a run command, using own passowrd!\n\nadding in apache &amp; also phpPgAdmin\n\ndownloaded postgres &amp; sudo&apos;d &amp; ran the .run file\n\ndid apt-get postgis\n\nrebuild from source ran into lots of missing pieces, i.e. xml-config\n\nhttp://linfiniti.com/2012/05/installing-postgis-2-0-on-ubuntu\n\nTrick was to go back to 9.1, then load in\nThen, load in tricks for 9.1\npushed to 9.2, but wroking on Mac\n\n
  • #21: \n\n\n
  • #22: A lot, ran into a series of fails on the compile, finally just gave up\nOne problem is that some tools not careful about where they litter: copies of &amp;#x201C;createdb&quot; in /usr/local a major problem: always check tools &amp; fix in the .profile\nThe configure broke: \n\nhad trouble with the createdb -- but still seems to have worked! as a postgis_template database had come into existence\nused scripts/launchpgadmin.sh to kick off a pgAdmin shell; preferred sudo\nbrought parallls up to rev\nfixed PGPORT using variable (&amp; pgpass) to 5432 (had been thinking it was 5433 -- this was all the low level tools, as psql)\nadded show_system =- true to get phpPgAdmin to work\nahd a lot of trouble with wronge createdb, until realize had to fix paths: see pg_env.sh &amp; . include that\nselect postgis_full_version(); - in a database to check\n\n\nselect oid, datname, datistemplate from pg_database;\ndrop database template_postgis2\n\nattempt to recompile from source died on some error messages about xml config, some more in the works\n-- tried various sources, but got things like createdb failures\n-- instructions basically require two things: 1) build from source all the way up 2) know what you are doing. Don&apos;t mind one, but two is a killer\n\nfigured I&apos;d just ask Jim &amp; Bruce\n\nCould have used a &quot;these are the big pieces&quot; cheat sheet; may even exist\n\nA lot of libraries have to be compiled into the tree; could walk up from ground but just poking at the problem is an issue.\n\n\n\n\n\n
  • #23: \n
  • #24: Downloaded 9.1 &amp; installed\nFound 9.2 already had postgis 2.0! Great -- one strategy is just to wait!\nBecause had already installed 9.1, was using port 5433 for postgres 9.2\nSo had to fix the phppgadmin/conf/config.inc.php file, to have it go to port 5433\nAfter a bit of futzing with the permissions, was up\nRan select version()\n\n\n\n
  • #25: \n
  • #26: PostGIS+JSON+Maps+Open+source\n
  • #27: \n
  • #28: \n
  • #29: \n
  • #30: \n
  • #31: \n
  • #32: \n
  • #33: \n
  • #34: \n
  • #35: \n
  • #36: \n
  • #37: \n
  • #38: \n
  • #39: \n
  • #40: \n
  • #41: \n
  • #42: \n
  • #43: \n
  • #44: And if you are prepping a demo for others:\n1) make it standalone\n2) test soup to nuts\n
  • #45: \n