The instructions on the QGIS download site are not as intuitive as I'd like, but they do work when you know the command syntax:
First, what version of Debian Linux (Ubuntu / Mint) are you running?
The codename of your APT repository will depend on the version of the OS and which version of QGIS you can run.
QGIS 3.x will run on Ubuntu 18.04 (bionic) and Linux Mint 19 (bionic) and above.
QGIS 2.18.x will run on Ubuntu 16.04 (xenial) and Linux Mint 18.x (xenial) and below.
Find the ubuntu version you are using and associated codename to replace the code option below (first two commands).
Add links to QGIS repositories
# Replace 'codename' with your ubuntu version codename in BOTH lines below
sudo sh -c 'echo "deb http://qgis.org/debian codename main" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb-src http://qgis.org/debian codename main " >> /etc/apt/sources.list'
wget -O - https://qgis.org/downloads/qgis-2019.gpg.key | gpg --import
gpg --fingerprint 51F523511C7028C3
gpg --export --armor 51F523511C7028C3 | sudo apt-key add -
sudo apt-get update && sudo apt-get install qgis python-qgis
- Keys last updated 09/10/2017
- Please leave a comment if you notice they need updating again, and I will update this answer
- The original QGIS instruction details are here
If you want to use QGIS 3.x on Ubuntu 16.04 or Linux Mint 18.x, run
sudo sh -c 'echo "deb http://qgis.org/ubuntugis xenial main" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb-src http://qgis.org/ubuntugis xenial main " >> /etc/apt/sources.list'
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
You will be missing some of the new 3D-features, but the rest of QGIS 3 is working.
unstable is a bit misleading, they have
experimental PPA's for the developing side.
The QGIS ubuntugis repo is updated monthly. In case the Ubuntugis PPA offers updates, you better disable it and wait until the next QGIS point release. Otherwise you may encounter packages held back or being removed. Apart from that, ther is no "unstable" side of this PPA.