In this chapter, we will install and configure the QGIS geographic information system. We will also get to know the user interface and how to customize it. By the end of this chapter, you will have QGIS running on your machine and be ready to start with the tutorials.
QGIS runs on Windows, various Linux distributions, Unix, Mac OS X, and Android. The QGIS project provides ready-to-use packages as well as instructions to build from the source code at http://download.qgis.org. We will cover how to install QGIS on two systems, Windows and Ubuntu, as well as how to avoid the most common pitfalls.
Further installation instructions for other supported operating systems are available at http://www.qgis.org/en/site/forusers/alldownloads.html.
Like many other open source projects, QGIS offers you a choice between different releases. For the tutorials in this book, we will use the QGIS 2.14 LTR version. The following options are available:
You can find more information about the releases as well as the schedule for future releases at http://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule.
For an overview of the changes between releases, check out the visual change logs at http://www.qgis.org/en/site/forusers/visualchangelogs.html.
On Windows, we have two different options to install QGIS, the standalone installer and the OSGeo4W installer:
Regardless of the installer you choose, make sure that you avoid special characters such as German umlauts or letters from alphabets other than the default Latin ones (for details, refer to https://en.wikipedia.org/wiki/ISO_basic_Latin_alphabet) in the installation path, as they can cause problems later on, for example, during plugin installation.
When the OSGeo4W installer starts, we get to choose between Express Desktop Install, Express Web-GIS Install, and Advanced Install. To install the QGIS LR version, we can simply select the Express Desktop Install option, and the next dialog will list the available desktop applications, such as QGIS, uDig, and GRASS GIS. We can simply select QGIS, click on Next, and confirm the necessary dependencies by clicking on Next again. Then the download and installation will start automatically. When the installation is complete, there will be desktop shortcuts and start menu entries for OSGeo4W and QGIS.
To install QGIS LTR (or DEV), we need to go through the Advanced Install option, as shown in the following screenshot:

This installation path offers many options, such as Download Without Installing and Install from Local Directory, which can be used to download all the necessary packages on one machine and later install them on machines without Internet access. We just select Install from Internet, as shown in this screenshot:

When selecting the installation Root Directory, as shown in the following screenshot, avoid special characters such as German umlauts or letters from alphabets other than the default Latin ones in the installation path (as mentioned before), as they can cause problems later on, for example, during plugin installation:

Then you can specify the folder (Local Package Directory) where the setup process will store the installation files as well as customize Start menu name. I recommend that you leave the default settings similar to what you can see in this screenshot:

In the Internet connection settings, it is usually not necessary to change the default settings, but if your machine is, for example, hidden behind a proxy, you will be able to specify it here:

Then we can pick the download site. At the time of writing this book, there is only one download server available, anyway, as you can see in the following screenshot:

After the installer fetches the latest package information from OSGeo's servers, we get to pick the packages for installation. QGIS LTR is listed in the desktop category as qgis-ltr (and the DEV version is listed as qgis-dev). To select the LTR version for installation, click on the text that reads Skip, and it will change and display the version number, as shown in this screenshot:

As you can see in the following screenshot, the installer will automatically select all the necessary dependencies (such as GDAL, SAGA, OTB, and GRASS), so we don't have to worry about this:

After you've clicked on Next, the download and installation starts automatically, just as in the Express version.
You have probably noticed other available QGIS packages called qgis-ltr-dev and qgis-rel-dev. These contain the latest changes (to the LTR and LR versions, respectively), which will be released as bug fix versions according to the release schedule. This makes these packages a good option if you run into an issue with a release that has been fixed recently but the bug fix version release is not out yet.
If you try to run QGIS and get a popup that says, The procedure entry point <some-name> could not be located in the dynamic link library <dll-name>.dll, it means that you are facing a common issue on Windows systems—a DLL conflict. This error is easy to fix; just copy the DLL file mentioned in the error message from C:\OSGeo4W\bin\ to C:\OSGeo4W\apps\qgis\bin\ (adjust the paths if necessary).
On Ubuntu, the QGIS project provides packages for the LTR, LR, and DEV versions. At the time of writing this book, the Ubuntu versions Precise, Trusty, Vivid, and Wily are supported, but you can find the latest information at http://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu. Be aware, however, that you can install only one version at a time. The packages are not listed in the default Ubuntu repositories. Therefore, we have to add the appropriate repositories to Ubuntu's source list, which you can find at /etc/apt/sources.list. You can open the file with any text editor. Make sure that you have super user rights, as you will need them to save your edits. One option is to use gedit, which is installed in Ubuntu by default. To edit the sources.list file, use the following command:
sudo gedit /etc/apt/sources.list
Downloading the example code
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Make sure that you add only one of the following package-source options to avoid conflicts due to incompatible packages. The specific lines that you have to add to the source list depend on your Ubuntu version:
deb http://qgis.org/debian trusty main deb-src http://qgis.org/debian trusty main
If necessary, replace trusty with precise, vivid, or wily to fit your system. For an updated list of supported Ubuntu versions, check out http://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu.
deb http://qgis.org/debian-ltr trusty main deb-src http://qgis.org/debian-ltr trusty main
deb http://qgis.org/debian-nightly trusty main deb-src http://qgis.org/debian-nightly trusty main
ubuntugis repository. Add these lines to your file:deb http://qgis.org/ubuntugis trusty main deb-src http://qgis.org/ubuntugis trusty main deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main
deb http://qgis.org/ubuntugis-ltr trusty main deb-src http://qgis.org/ubuntugis-ltr trusty main deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main
deb http://qgis.org/ubuntugis-nightly trusty main deb-src http://qgis.org/ubuntugis-nightly trusty main deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu trusty main
After choosing the repository, we will add the qgis.org repository's public key to our apt keyring. This will avoid the warnings that you might otherwise get when installing from a non-default repository. Run the following command in the terminal:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 3FF5FFCAD71472C4
By the time this book goes to print, the key information might have changed. Refer to http://www.qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu for the latest updates.
Finally, to install QGIS, run the following commands:
sudo apt-get update sudo apt-get install qgis python-qgis qgis-plugin-grass