There are several steps to install QGis, none are difficult but you do have to follow all of them in order.
First install the needed software tools:
sudo apt install gnupg software-properties-common
Then you need to add the signing key:
sudo mkdir -m755 -p /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/qgis-archive-keyring.gpg https://download.qgis.org/downloads/qgis-archive-keyring.gpg
The first line creates the keyring directory if it doesn't exist and then 2nd fetches the key and stores in the directory you just created.
Then you add the repository (repo) details to /etc/apt/sources.list.d/qgis.sources
using any editor.
sudo nano /etc/apt/sources.list.d/qgis.sources
and copy and paste in the magic text:
Types: deb deb-src
URIs: https://qgis.org/debian
Suites: your-distributions-codename
Architectures: amd64
Components: main
Signed-By: /etc/apt/keyrings/qgis-archive-keyring.gpg
Taking care to replace your-distributions-codename
with your distributions name (e.g. jammy). If you don't know what your release is use lsb_release -cs
to check.
Now you need to let apt
know that there is a new repository:
sudo apt update
then you can install QGis in the same way as any other package.
sudo apt install qgis qgis-plugin-grass
This will install (and keep updating) the latest release, if you prefer the LTR version then use the URL https://qgis.org/debian-ltr
in the line that starts URIs
in /etc/apt/sources.list.d/qgis.sources
.