Skip to content

PostGIS 2.1 on Debian 7


Newly released PostGIS 2.1 rocks.. How can I install it on a fresh Debian 7 ‘wheezy’ to try it out?
Here is a recipe that worked for me:

Final Results
debian_version 7.1
PostgreSQL 9.1.9 on x86_64-unknown-linux-gnu
myrole=# select postgis_full_version();

POSTGIS="2.1.1dev r11823"
GEOS="3.4.2dev-CAPI-1.8.0 r3897"
PROJ="Rel. 4.7.1, 23 September 2009"
GDAL="GDAL 1.11dev, released 2013/04/13"

Shell Steps

df -h
sudo apt-get update
mkdir srcs_local
cd srcs_local
sudo apt-get install build-essential flex autoconf libtool gdb gfortran subversion htop
sudo apt-get install postgresql-plpython-9.1 postgresql-server-dev-all python-psycopg2
sudo apt-get install xsltproc libproj-dev python2.7-dev

svn co geos_34_branch
cd geos_34_branch/
make -j6
sudo make install
ls -l /usr/local/lib
cd ..

sudo apt-get install libcurl4-openssl-dev libgcrypt11-doc
sudo apt-get install libpcre3-dev libjson0-dev libxerces-c-dev libexpat1-dev libxml2-dev
sudo apt-get install libkml-dev

svn co gdal_trunk
cd gdal_trunk/gdal
./configure --with-python --with-curl
make -j6
sudo make install
sudo ldconfig # for good luck

cd ../autotest/
##-- test out the new gdal

## PostGIS
cd ../..
svn co postgis_21_branch
cd postgis_21_branch/

make -j4
sudo make install
sudo ldconfig # for good luck

sudo su - postgres
# psql
> create role myrole superuser createdb login;
exit ## out of linux user postgres shell
createdb myrole

sudo service postgresql restart

The libraries in /usr/local/lib are symbolically linked. It ends up looking like this:

libgdal.a -> ->
libgeos_c.a -> -> ->
liblwgeom.a ->