- -

PDFPDF version

QGIS Installation Guide

For Versions 0.0.13 and Higher

Introduction

This document briefly describes how to build QGIS from the source distribution. The information below is for version 0.0.13 of QGIS.

QGIS requires that a number of libraries be installed on your system:

Each of these requirements are discussed below. Note that the information given below is abstracted from the installation documentation for each of the libraries. See the install information for each library to get detailed instructions.

If you are building QGIS without PostgreSQL, skip to the section on Installing GDAL/OGR.

PostgreSQL

PostgreSQL Versions 7.3 and higher:

  1. Download PostgreSQL source from www.postgresql.org
  2. Configure PostgreSQL:
    	./configure --prefix=/usr/local/pgsql 
  3. Build and install PostgreSQL using the information provided in the INSTALL file of the PostgreSQL distribution.
  4. Download the C++ wrapper libpq++ from http://gborg.postgresql.org/project/libpqpp/projdisplay.php
  5. Follow the instructions in the libpq++ README to make and install the library

PostgreSQL Versions prior to 7.3:

  1. Download PostgreSQL source from www.postgresql.org
  2. The C++ wrapper libpq++ is bundled with versions prior to 7.3. Use the --with-CXX option to configure PostgreSQL to use the C++ wrapper
    	./configure --prefix=/usr/local/pgsql --with-CXX
  3. Build and install PostgreSQL using the information provided in the INSTALL file of the PostgreSQL distribution.

All Versions:

  1. Create the postgres user and setup the database (following taken from PostgreSQL INSTALL file with modification):
    As root:
     adduser postgres
     mkdir /usr/local/pgsql/data
     chown postgres /usr/local/pgsql/data
     su - postgres
     cd /usr/local/pgsql
     ./bin/initdb -D /usr/local/pgsql/data
     ./bin/pg_ctl start  -o "-i" -D /usr/local/pgsql/data -l serverlog
     ./bin/createdb test
    
  2. PostgreSQL should now be running. Logon as the postgres user (or use su - postgres). You should be able to connect to the test database with the command:
    	psql test
    
  3. PostgreSQL install is done.

PostGIS

  1. Download PostGIS source from postgis.refractions.net
  2. Untar PostGIS into the contrib subdirectory of the postgresql build directory
  3. PostGIS provides a manual in the doc/html subdirectory that explains the build process (see the Installation section)
  4. Follow instructions in the PostGIS manual
  5. If you will not be using PostgreSQL/PostGIS, you do not need to follow the steps regarding the procedural language extension
  6. PostGIS library is now installed

GDAL/OGR

The GDAL and OGR libraries provide support for raster and vector data formats. QGIS makes use of both of these libraries (which come bundled in one distribution). Note: A Linux binary of GDAL is available at http://www.remotesensing.org/gdal. If you choose to install the binary you will also need to download and unpack the source tree since QGIS needs the header files in order to compile.

To install GDAL/OGR from source:

  1. Download the GDAL distribution from http://www.remotesensing.org/gdal
  2. Untar the distribution
  3. Change to the gdal-x.x.x subdirectory that was created by step 2
  4. See the documentation in the ./html subdirectory for information on building GDAL.
  5. Follow the instructions in the Building GDAL From Source section
  6. Make sure that gdal-config (found in the bin subdirectory where GDAL was installed) is included in the PATH. If necessary, add the path to gdal-config to the PATH environment variable.

Qt

You must download and install Qt in order to compile QGIS. You may already have Qt on your system. If so, check to see if you have version Qt 3.1 or later. To install Qt:

  1. Download Qt from http://www.trolltech.com/developer (choose the Qt/X11 Free Edition)
  2. Unpack the distribution
  3. Follow directions provided in the distribution directory doc/html/install-x11.html
  4. Use whatever configure options you like but make sure you include -thread for use with QGIS. You can configure Qt with minimal options:
    ./configure -thread
  5. Complete the installation per the instructions provided in the Qt documentation (see step 3)

Building QGIS

After you have installed the required libraries, you are ready to build QGIS.

As of version 0.0.13, QGIS uses GNU Autoconf to configure the software prior to building.

Quick and Dirty

If you don't need PostgreSQL support and have installed GDAL , you can configure and build QGIS by changing to the distribution directory and typing:

./configure
make
make install
Note
This assumes that the gdal-config program is in your PATH

See the next section for the full configuration instructions.

Configuring QGIS

To see the configure options available, change the the QGIS directory and enter:

./configure --help

Among other options, there are three that are important to the success of the build:

--with-qtdir=DIR              Qt installation directory default=$QTDIR
--with-gdal=path/gdal-config  Full path to 'gdal-config' script,
                              e.g. '--with-gdal=/usr/local/bin/gdal-config'
--with-pg=path/pg_config      PostgreSQL (PostGIS) Support
                              (full path to pg_config)
		

Qt

The configure script will detect Qt, unless it is installed in a non-standard location. Setting the QTDIR environment variable will make ensure that the detection succeeds. You can also specify the path using the --with-qtdir option.

GDAL

If the gdal-config script is in the PATH, configure will automatically detect and configure GDAL support. If not in the path, you can specify the full path to gdal-config using the --with-gdal option. For example:

./configure --with-gdal=/usr/mystuff/bin/gdal-config

PostgreSQL

If the pg_config script is in the PATH, configure will automatically detect and configure PostgreSQL support. If not, you can use the --with-pg option to specify the full path to pg_config. For example:

./configure --with-pg=/usr/local/psql/bin/pg_config

Example Use of Configure

./configure --prefix=/usr/local/qgis 
	--with-gdal=/usr/local/gdal/bin/gdal-config
	--with-pg=/usr/local/psql/bin/pg_config

This will configure QGIS to use both GDAL and PostgreSQL. QGIS will be installed in /usr/local/qgis.

Note
If QTDIR is set and gdal-config and pg_config are both in the PATH, there is no need to use the --with-gdal and --with-pg options. The configure script will properly detect and configure GDAL and PostgreSQL

Compiling and Installing QGIS

Once properly configured simply issue the following commands:

make
make install

SourceForge.net Logo

by Gary E. Sherman