How to install the latest QGIS on Mint/Ubuntu

Here are how to install stable and unstable versions of Qgis.

Edit /etc/apt/sources.list and add the following lines:

Unstable edition

# qgis unstable
deb xenial main
deb-src xenial main
deb xenial main

N.B. change xenial to the codename of whatever release of Ubuntu you have installed.

Stable or LTR editions
Change these lines in accordance with the instructions given on the Qgis download page.

Then enter these commands (all as root):

apt add-repository ppa:ubuntugis/ubuntugis-unstable

apt update

You will get this error message

W: GPG error: trusty InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 3FF5FFCAD71472C4

To fix this you need to run the following command:

apt-key adv –keyserver –recv-keys 3FF5FFCAD71472C4

Followed by 
apt update 
apt install qgis