Prerequisites
PostgreSQL
You need to already have PostgreSQL, its dev package, and it libraries installed. On Fedora-based distributions, it looks like this:
1 2 3 4 5 6 7 |
[root@branchpoint build]# rpm -qa | sort | grep -i postgresql postgresql92-9.2.9-1.46.amzn1.x86_64 postgresql92-devel-9.2.9-1.46.amzn1.x86_64 postgresql92-libs-9.2.9-1.46.amzn1.x86_64 postgresql92-server-9.2.9-1.46.amzn1.x86_64 postgresql92-server-compat-9.2.9-1.46.amzn1.x86_64 [root@branchpoint build]# |
Eat Your Wheaties
- Setup local time zone.
- Update installed packages.
- Reboot.
1 2 3 |
sudo ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime sudo yum update -y sudo shutdown -r now |
Install Essential Prerequisite Packages
1 2 3 |
sudo yum groupinstall "Development Tools" sudo yum -y install readline-devel sudo yum -y install zlib-devel libxml2-devel wget vim |
Build PostGIS Prerequisites
For each of the following libraries, we go through these steps:
- Configure, passing in --prefix=/usr and --libdir=/usr/lib64 .
- Compile using make .
- Install using make .
Working Directory
1 2 3 |
cd ~ mkdir ~/build cd build |
proj4
1 2 3 4 5 6 7 8 |
wget http://download.osgeo.org/proj/proj-4.8.0.tar.gz gzip -d proj-4.8.0.tar.gz tar -xvf proj-4.8.0.tar cd proj-4.8.0 ./configure --prefix=/usr --libdir=/usr/lib64 make -j4 sudo make install cd .. |
GEOS
This one takes a while. On a “medium” sized server, running 4 parallel build processes, it takes about 10 minutes.
1 2 3 4 5 6 7 8 |
wget http://download.osgeo.org/geos/geos-3.3.7.tar.bz2 bzip2 -d geos-3.3.7.tar.bz2 tar -xvf geos-3.3.7.tar cd geos-3.3.7 ./configure --prefix=/usr --libdir=/usr/lib64 make -j4 sudo make install cd .. |
JSON-C
1 2 3 4 5 6 7 8 |
wget http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz gzip -d json-c-0.9.tar.gz tar -xvf json-c-0.9.tar cd json-c-0.9 ./configure --prefix=/usr --libdir=/usr/lib64 make -j4 sudo make install cd .. |
GDAL
This one takes a full 20 minutes to build.
1 2 3 4 5 6 7 8 |
wget http://download.osgeo.org/gdal/gdal-1.9.2.tar.gz gzip -d gdal-1.9.2.tar.gz tar -xvf gdal-1.9.2.tar cd gdal-1.9.2 ./configure --prefix=/usr --libdir=/usr/lib64 make -j4 sudo make install cd .. |
PostGIS
Now that we have all the dependencies installed, building and installing PostGIS from source is relatively quick.
1 2 3 4 5 6 7 8 9 |
wget http://download.osgeo.org/postgis/source/postgis-2.1.3.tar.gz tar xfz postgis-2.1.3.tar.gz cd postgis-2.1.3 ./configure --prefix=/usr --libdir=/usr/lib64 make sudo make install sudo ldconfig sudo make comments-install cd .. |