
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:
- Qt
- GDAL
- PostgreSQL (Optional)
- libpq++ (C++ API for PostgreSQL - Optional)
- PostGIS (Optional)
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:
- Download PostgreSQL source from www.postgresql.org
- Configure PostgreSQL:
./configure --prefix=/usr/local/pgsql
- Build and install PostgreSQL using the information provided in the INSTALL file of the PostgreSQL distribution.
- Download the C++ wrapper libpq++ from http://gborg.postgresql.org/project/libpqpp/projdisplay.php
- Follow the instructions in the libpq++ README to make and install the library
PostgreSQL Versions prior to 7.3:
- Download PostgreSQL source from www.postgresql.org
- 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
- Build and install PostgreSQL using the information provided in the INSTALL file of the PostgreSQL distribution.
All Versions:
- 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
- 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
- PostgreSQL install is done.
PostGIS
- Download PostGIS source from postgis.refractions.net
- Untar PostGIS into the contrib subdirectory of the postgresql build directory
- PostGIS provides a manual in the doc/html subdirectory that explains the build process (see the Installation section)
- Follow instructions in the PostGIS manual
- If you will not be using PostgreSQL/PostGIS, you do not need to follow the steps regarding the procedural language extension
- 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:
- Download the GDAL distribution from http://www.remotesensing.org/gdal
- Untar the distribution
- Change to the gdal-x.x.x subdirectory that was created by step 2
- See the documentation in the ./html subdirectory for information on building GDAL.
- Follow the instructions in the Building GDAL From Source section
- 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.
- Check the install by running: gdal-config --prefix
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:
- Download Qt from http://www.trolltech.com/developer (choose the Qt/X11 Free Edition)
- Unpack the distribution
- Follow directions provided in the distribution directory doc/html/install-x11.html
- 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
- 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
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.
Compiling and Installing QGIS
Once properly configured simply issue the following commands:
make make install