Installing and QGIS and PostgreSQL/PotsGIS on Ubuntu

I work on many different machines and somehow find myself frequently getting a hold of new computers, reinstalling OS’s, etc. It’s a pain to reinstall some of my commonly used software as it often involves consulting multiple sources to get the configuration that I’m looking for. Further, many step-by-step installation instructions on blog sites don’t worked for me.

Lately I’ve been better about keeping track of the specific packages/sources/respositories I use, and someday I hope to be able to simply execute a bash script after an OS re/install that adds a set of repositories and installs a list of software packages automatically (it would also be nice to execute a script that creates symbolic links to my .rc and config files in my cloud storage as well.. know anything about this or have any tips? Let me know!).

This guide will serve as a future reference for myself and will hopefully help others as well.


The lines below install PostgreSQL 9.4 with PostGIS 2.1 (along with some other stuff like PG Admin 3). This method is taken in bits and pieces from the PostGIS users wiki.

sudo sh -c 'echo "deb trusty-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.4-postgis-2.1 pgadmin3 postgresql-contrib-9.4
sudo apt-get install postgis


For some reason, certain tools, like shp2pgsql are not included in the packages listed in the fourth line of code above, but

 sudo apt-get install postgis

takes care of this and completes the installation for me. Occasionally, you may need to do

sudo service postgresql restart

after installation. Also, you will need to create a user name with something along the lines of

sudo -u createuser -s desired_user_name

It is often convenient to use the same user name as your Ubuntu user name.


The following lines of code install the current unstable version (QGIS 2.14 Essen) on Ubuntu 14.04. This installation method is an agglomeration of those from the QGIS docs and a @DPSSpatial GIS Stack Exchange answer .

sudo sh -c 'echo "deb trusty main" >> /etc/apt/sources.list' # add repository to sources.list
sudo sh -c 'echo "deb-src trusty main" >> /etc/apt/sources.list' # add repository to sources.list
sudo apt-key adv --keyserver --recv-key 3FF5FFCAD71472C4 # add verification key (you'll get an error on all apt-get in the future without this)
sudo apt-get update # update repositories
sudo apt-get install qgis python-qgis qgis-plugin-grass # install qgis with pyqgis and grass as well


After this, I immediately install several plugins:  Load QSS – UI Themes (for the dark theme) and Open Layers (for basemaps).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s