Say you're using pgvm
to manage several versions of Postgres and you need to install the PostGIS extension.
Prerequisites:
- If you have installed PostGIS via brew before, uninstall it:
$ brew uninstall postgis
- Install your favorite Postgres version via pgvm:
$ pgvm install 9.3.12
- Use the Postgres version you want to install PostGIS to:
$ pgvm use 9.3.12
- Create and start a pgvm cluster:
$ pgvm cluster create my_cluster
$ pgvm cluster start my_cluster
- Set the environment variable PGPORT to your cluster's port. You can find out the port of your cluster with
$ pgvm cluster list
Installation
- Install dependencies via brew:
$ brew install geos proj gdal libxml2 json-c
- Download and unpack the source for your chosen PostGIS version:
$ wget http://download.osgeo.org/postgis/source/postgis-2.2.2.tar.gz
$ tar xvfz postgis-2.2.2.tar.gz
$ cd postgis-2.2.2
- Configure with the path to your
proj
andjson-c
(adapt version numbers to your taste):
$ ./configure --with-projdir=/usr/local/Cellar/proj/4.9.3 --with-jsondir=/usr/local/Cellar/json-c/0.12
- Compile and install!
$ make
$ sudo make install
- Create the PostGIS extension in the pgvm console:
$ pgvm console my_cluster
postgres=# CREATE EXTENSION IF NOT EXISTS postgis;
<3 to @tessi for finding out.
Posted by Rin to BitCrowd (2016-05-31 08:47)