This guide is explicitly for PostgreSQL 9.1 or higher on linux machines. It uses the postgres extensions-feature that will greatly improve the import of extensions to an existing postgres-installation. If you have to work with an older version of postgres, please refer to the official documentations.
Resolve dependencies
PostGIS is a complex project that has a number of dependencies. In order to proceed with the manual configuration and build procedure, you will have to resolve these dependencies and install the following packages either manually or via the package-managers.
Minimum Requirements
Optional Requirements
Get the Sources
In order to get the source code, download the latest tarball:
wget http://postgis.net/stuff/postgis-2.3.2dev.tar.gz
tar -xvzf postgis-2.3.2dev.tar.gz
or use the official SVN-repository:
svn checkout http://svn.osgeo.org/postgis/trunk/ postgis-2.3.2dev
Configuration
If you obtained the sources via SVN, you can prepare the config-script with:
./autogen.sh
In order to configure the build-process for your specific machine, run in the project folder:
./configure
There are several optional parameters for the configuration-step. Please refer to the official documentation for detailed instructions, this is usually optional and only for servers that use non-default installations.
Build
Once the configuration-step has finished successfully, a makefile will be created. To start the build-process run:
make
The last output should be:
"PostGIS was built successfully. Ready to install."
As of version 1.4.0, all the functions have comments generated from the documentation. If you wish to install these comments into your spatial databases later, run the command which requires docbook.
make comments
Installation
Install all extensions with:
make install
The PostGIS extensions are built and installed automatically if you are using PostgreSQL 9.1 or higher. You can install the necessary extensions manually, if you have different setup.
In the project folder:
cd extensions
cd postgis
make clean
make
make install
cd ..
cd postgis_topology
make clean
make
make install
cd ..
cd postgis_sfcgal
make clean
make
make install
cd ..
cd address_standardizer
make clean
make
make install
make installcheck
cd ..
cd postgis_tiger_geocoder
make clean
make
make install
make installcheck
If you want to install the extensions manually on a different machine, copy the following files from the extensions
folder into the PostgreSQL/share/extension
-folder of the target. For each extension:
scp extensions/[EXTENSION]/sql/*.sql user@target:[POSTGIS_PATH]/share/extension
where [EXTENSION] is the selected extension (postgis, postgis_topology, postgis_sfcgal, address_standardizer, postgis_tiger_geocoder) and [POSTGIS_PATH] is the PostGIS installation-path on your target-machine.
Verifiying the Installation
If you don't have a running postgres database service, setup your postgres database first. Connect to the database, using:
su postgres -c psql
To verify that the extensions are accessible, run the following queries in a psql-session:
SELECT name, default_version,installed_version FROM pg_available_extensions WHERE name LIKE 'postgis%' or name LIKE 'address%';
The output should look like this:
name | default_version | installed_version
------------------------------+-----------------+-------------------
address_standardizer | 2.3.2dev | 2.3.2dev
address_standardizer_data_us | 2.3.2dev | 2.3.2dev
postgis | 2.3.2dev | 2.3.2dev
postgis_sfcgal | 2.3.2dev |
postgis_tiger_geocoder | 2.3.2dev | 2.3.2dev
postgis_topology | 2.3.2dev |
(6 rows)
To perform an in-depth post-installation test, run the following command in your project-folder:
make check
This will run through various checks and tests using the generated library against an actual PostgreSQL database.