PostGIS RPM Installation

Version:1.0.4 for PostGIS RPM Set
Author:Devrim Gunduz <devrim@…>
Date:Oct 04, 2005


This document exists to explain the layout of the RPM for PostGIS .

This document is written to be applicable to version 1.0.X of PostGIS which is the current version of the RPM's as of this writing. More to the point, versions prior to 1.0.X are not documented here.

It is preferable for the distribution-specific set to be the one used. If you want to stay up-to-date on the PostGIS core itself, use the community RPMS. These RPMs are kept up2date.

PostGIS RPM is installed as every RPM, so it is not mentioned in here.


To build RPMs, you'll need the following:

  • The source tarball of PostGIS.
  • PostGIS spec (see extras/rpm/spec for the file)
  • Some patches/sources from CVS (see extras/rpm/patches for the files)

Please note that you'll need some development tools for building PostGIS. You'll be prompted for this prerequisites.

Here is a basic guide for building RPMs:

  1. Move the patches/sources and source tarball into /usr/src/redhat/SOURCES
  2. Next, move the spec file under /usr/src/redhat/SPECS
  3. Run the following command: rpmbuild -bb postgis.spec

This will build RPMs for you.

NOTES (neverhood@…) for building postgis-1.3.1 on Fedora Core 6.

I found that spec file in postgis-1.3.1tar.gz have invalid make command. In original spec file it is:

make %{?_smp_mflags} LPATH=`pg_config --pkglibdir` shlib="%{name}.so"

(and with that command you'll get incorrect lwpostgis.sql and spatial_ref_sys.sql files).

Replace this command with that one:

make %{?_smp_mflags} LPATH=`pg_config --pkglibdir`

After this changes you'll get right postgis rpm package. /* end of notes */

The RPMs will be placed under /usr/src/redhat/RPMS/i386/ If you specify an explicit target while rpmbuild, then the directory may change:

Command: rpmbuild -bb --target i686 postgis.spec
Resulting directory: /usr/src/redhat/RPMS/i686/


To be in compliance with the Linux FHS, the PostGIS RPMs install files in a manner not consistent with most of the PostGIS documentation. According to the standard PostGIS documentation, PostGIS is installed under the directory /usr/local, with executables, source, and data existing in various subdirectories.

Different distributions have different ideas of some of these file locations. In particular, the documentation directory can be /usr/doc, /usr/doc/packages, /usr/share/doc, /usr/share/doc/packages, or some other similar path. The current Red Hat / Fedora Core locations are listed below.

However, the RPM's install the files like this:

Executables: /usr/bin
Libraries: /usr/lib
Documentation: /usr/share/doc/postgis-x.y.z
JDBC2 related: /usr/shara/java
Perl utils: /usr/bin

Use of 'rpm -ql' for each package is recommended as the 'Official' location source.

While it may seem gratuitous to place these files in different locations, the FHS requires it -- distributions should not ever touch /usr/local. It may also seem like more work to keep track of where everything is -- but, that's the beauty of RPM -- you don't have to keep track of the files, RPM does it for you.

These RPMs are designed to be LSB-compliant -- if you find this not to be the case, please let me know by way of the postgis-devel@… mailing list.


If your distribution is not supported by the binary RPM's from, you will need to rebuild from the source RPM. Download the .src.rpm for this release. You will need to be root to rebuild, unless you have already set up a non-root build environment.

Install the source RPM with rpm -i, then CD to the rpm building area (on RedHat? or Fedora Core, this is /usr/src/redhat by default). You will have to have a full development environment to rebuild the RPM.

This release of the RPM includes the ability to conditionally build sets of packages. The parameters, their defaults, and the meanings are:

jdbc2: Build the RPM with jdbc2 support (default value is 1)
utils: Build the RPM with perl utils (default value is 1)

To use these defines, invoke a rebuild like this:

 rpm --rebuild --define 'jdbc2 0 ' --define 'utils' postgis-1.0.4-1.src.rpm

This line would disable the jdbc2 and utils, if requested.

Please note that the spec file needs some patches to PostGIS source tree to build, so you may need to download them via CVS before rebuilding the package.


You can get more information at

Please help make this packaging better -- let me know if you find problems, or better ways of doing things. You can reach us by e-mail at postgis-devel@… .

Last modified 9 years ago Last modified on Apr 13, 2009 2:33:25 PM