These instructions are primarily intended to assist participants in the What’s the deal with PostGIS workshop organized by MaptimePHL. Of course, they may be useful to anyone who is new to PostGIS and considering installing it for any purpose.
PostGIS and PostgreSQL can be installed in many different ways, including installing from source for those who want bleeding edge features or who need to run it on unusual architectures. This workshop is geared toward people who are new to PostGIS but technically savvy, so I am suggesting a range of methods of varying complexity.
I recommend that everyone
OpenGeo Suite Installer
The simplest way to install PostGIS on Windows is to install OpenGeo Suite. This will also work for Mac or Linux, though I give additional choices below for these OSes. Installing this way will automatically initialize a cluster on localhost and configure pgAdmin to connect to it using trust authentication.
OpenGeo Suite is free, but you will have to register with Boundless to download it. When given the choice, make sure to select to install Client Tools, which will include pgAdmin for server management and the
psql terminal client. You can uncheck
Boundless’ own Intro to PostGIS workshop provides more detailed installation instructions and step-by-step screenshots of the installer.
Boundless staff include core committers to PostGIS.
The EnterpriseDB installer is more oriented toward a general PostgreSQL install. Versions of the installer are available for Windows, Mac, and Linux. PostGIS will not install by default. After running the installer, you will be prompted to launch StackBuilder. In StackBuilder you will be able to select PostGIS (and other extensions) for installation.
You will not have to register to download EnterpriseDB. pgAdmin will be installed automatically.
If you would like to sandbox your PostGIS experiment, and/or if you are familiar with running virtual machines, I highly recommend that you consider trying out OSGeo-Live, a Linux distro chock full of geospatial software, including QGIS, which we also be making use of in this workshop. You will get an already configured PostGIS installation with some sample data built in.
The absolute fastest way to get up and running is to download the prebuilt VMDK and run it in VirtualBox or another virtualization software.
Mac Installation Options
The previous three options will all work for Mac. I don’t know anything about Mac, but I do know that Mac users like to think different(ly). I know people who have had good experience with Postgres.app. I know others who insist on doing everything through Homebrew. Here is a list of all the ways to install PostgreSQL on a Mac. Including the EnterpriseDB installer mentioned above.
By far the easiest installation option…if you already use Linux. (If not, try out OSGeo-Live.) For Ubuntu-based installations:
sudo apt-get install postgis postgresql-contrib pgadmin3
There, your done!
The Boundless and EnterpriseDB installers are also available for Linux, but I have a strong bias in favor of using the package manager.
Far more extensive instructions are available on my blog, which also discusses cluster management and restoring an old database after an upgrade.