Software ManagementLesson 4 of 4
Flatpak remotes and applications
Add a Flatpak remote, install an application from it, run it, update it and remove both again.
flatpakflatpak remote-addflatpak remotesflatpak searchflatpak installflatpak listflatpak runflatpak uninstallflatpak remote-delete
After this lesson you can
- Explain what Flatpak adds to RPM and DNF, and the difference between system and user installations.
- Add, list and remove a Flatpak remote, then install, list, run, update and uninstall an application.
- Work with a remote that is local or unsigned, as in an offline exam or lab.
The idea
RPM packages are built for one distribution, and share libraries with the rest of the system. A Flatpak is an application packaged together with a runtime (the libraries it needs), installed in its own sandbox. That lets one application version run on many Linux versions, independent of the system’s own package versions. Red Hat added Flatpak management to the RHCSA objectives because desktop and some vendor applications are distributed this way.
Vocabulary:
| Term | Meaning |
|---|---|
| Remote | A Flatpak repository, like a DNF repository but with a name and a URL |
| Application ID | A reverse-domain name such as org.gnome.Calculator, used to refer to the app |
| Runtime | Shared libraries an application needs; installed automatically |
| Installation | system (all users, needs root) or user (just you, no root) |
The parallels with DNF make it easy to remember:
| Task | DNF | Flatpak |
|---|---|---|
| Add a source | write a .repo file | flatpak remote-add NAME URL |
| List sources | dnf repolist | flatpak remotes |
| Search | dnf search | flatpak search |
| Install | dnf install | flatpak install REMOTE APPID |
| List installed | dnf list installed | flatpak list |
| Update | dnf upgrade | flatpak update |
| Remove | dnf remove | flatpak uninstall APPID |
By default flatpak commands act on the system installation, and installing needs root (or polkit authorisation). --user works in your home without root and affects only you. In an exam or on a server, use the system installation unless told otherwise, and be consistent: an app installed with --user is invisible to flatpak list without that option.
Try it
rpm -q flatpak || sudo dnf install -y flatpak
flatpak --version
Flatpak 1.16.1
Add a remote
sudo flatpak remote-add --if-not-exists lab-remote https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak remotes
Name Options
lab-remote system
The URL ends in .flatpakrepo, a small description file that carries the remote’s address and signing key. Red Hat publishes its own remote for supported applications, and the exact URL and any login it needs are in the official documentation; on an exam system the task states the location to use.
Install, inspect, run
flatpak search calculator | head -3
sudo flatpak install -y lab-remote org.gnome.Calculator
flatpak list
Name Application ID Version Branch Remotes
Calculator org.gnome.Calculator 47.0 stable lab-remote
Name Application ID Version Branch Origin Installation
Calculator org.gnome.Calculator 47.0 stable lab-remote system
flatpak info org.gnome.Calculator | head -6
flatpak run org.gnome.Calculator
Calculator - Perform arithmetic, scientific or financial calculations
ID: org.gnome.Calculator
Ref: app/org.gnome.Calculator/x86_64/stable
Arch: x86_64
Branch: stable
Version: 47.0
Update and remove
sudo flatpak update -y
sudo flatpak uninstall -y org.gnome.Calculator
sudo flatpak uninstall -y --unused
sudo flatpak remote-delete lab-remote
Uninstalling an app leaves its runtimes behind; --unused removes runtimes nothing needs any more. remote-delete fails while applications from that remote are still installed, so remove the apps first.
An unsigned or local remote
A repository you built yourself, or one served inside a lab, may have no signing key. --no-gpg-verify skips the check:
sudo flatpak remote-add --if-not-exists --no-gpg-verify internal http://repo.example.com/flatpak
flatpak list --columns=application,origin
Going further
flatpak remote-ls REMOTE lists everything a remote offers, and flatpak remote-modify changes a remote’s settings. flatpak override adjusts an app’s sandbox permissions, for example --filesystem=/data. flatpak history shows past operations, and flatpak repair fixes a damaged installation. flatpak install --noninteractive and -y are for scripts. Flatpak applications are updated separately from RPM packages, so dnf upgrade does not touch them: schedule flatpak update as well if you keep apps installed.
Practice
0 of 5 done
Do these on your own system. They get harder. Check each result, then tick it off.
- Warm-up
Make sure Flatpak is available
Check whether the
flatpakcommand exists. If not, install it with DNF. Show its version and the list of configured remotes (there may be none).Check your result
flatpak --versionprints a version.flatpak remotesprints a table, possibly empty.Hint
rpm -q flatpak,sudo dnf install -y flatpak.Solution
rpm -q flatpak || sudo dnf install -y flatpak flatpak --version flatpak remotes - Practice
Add a remote
Add a system-wide Flatpak remote named
lab-remotefrom the URL given in your task (for examplehttps://dl.flathub.org/repo/flathub.flatpakrepoif your lab has internet). Do not fail if it already exists. Show that it is configured.Check your result
flatpak remoteslistslab-remotewith the optionsystem. Running the add command twice does not error.Hint
flatpak remote-add --if-not-exists NAME URL. Without--user, flatpak writes to the system installation and needs root.Solution
sudo flatpak remote-add --if-not-exists lab-remote https://dl.flathub.org/repo/flathub.flatpakrepo flatpak remotes - Practice
Install, list and run an application
Search the remote for the
Calculatorapplication, install the one whose application ID isorg.gnome.Calculatorfor all users, confirm it is installed, and show its details. (On a server without a desktop, skip the run step and readflatpak info.)Check your result
flatpak listincludesorg.gnome.Calculator.flatpak info org.gnome.CalculatorshowsID,Ref,Origin: lab-remoteandInstallation: system.Hint
flatpak search calculator,sudo flatpak install -y lab-remote org.gnome.Calculator,flatpak list,flatpak run APPID.Solution
flatpak search calculator | head sudo flatpak install -y lab-remote org.gnome.Calculator flatpak list flatpak info org.gnome.Calculator - Practice
Update and remove
Update all Flatpak applications, then uninstall the calculator, remove its unused runtimes, and delete the remote. Confirm nothing is left.
Check your result
After the steps
flatpak listis empty (or shows only other apps) andflatpak remotesno longer listslab-remote.Hint
sudo flatpak update -y,sudo flatpak uninstall -y APPID,sudo flatpak uninstall -y --unused,sudo flatpak remote-delete lab-remote.Solution
sudo flatpak update -y sudo flatpak uninstall -y org.gnome.Calculator sudo flatpak uninstall -y --unused sudo flatpak remote-delete lab-remote flatpak list flatpak remotes - Challenge
A remote with no internet
You are told the exam machine has no internet but an administrator has published a Flatpak repository at
http://repo.example.com/flatpakthat is not signed. Describe the commands to add it as a system remote namedinternal, install an application from it, and say which option disables signature checks and why you should only use it for a repository you control. Then show how to confirm which remote an installed application came from.Check your result
The add command uses
--no-gpg-verifyand the URL.flatpak list --columns=application,originshowsinternalas the origin.Hint
sudo flatpak remote-add --if-not-exists --no-gpg-verify internal http://repo.example.com/flatpak. Origin is a column offlatpak list.Solution
sudo flatpak remote-add --if-not-exists --no-gpg-verify internal http://repo.example.com/flatpak flatpak remotes sudo flatpak install -y internal APPLICATION-ID flatpak list --columns=application,origin