Flatpak and
Application Repositories

Configure access to Flatpak repositories

CIS126RH | RHEL System Administration 1
Mesa Community College

Flatpak is a modern application packaging format that delivers sandboxed applications independent of the host operating system version. On RHEL, Flatpak complements the RPM package system by providing access to a broader range of desktop applications from the Flathub community repository. This module covers how Flatpak works, how to configure remote repositories, and how to install and manage Flatpak applications.

Learning Objectives

  1. Explain what Flatpak is and how it differs from RPM — Describe the sandboxed application model and why Flatpak exists alongside RPM
  2. Install the Flatpak tooling on RHEL — Install the flatpak package and confirm the runtime is ready
  3. Add and manage Flatpak remotes — Configure access to Flathub and other repositories using flatpak remote-add
  4. Install, update, and remove Flatpak applications — Use flatpak install, flatpak update, and flatpak uninstall to manage the application lifecycle

What is Flatpak?

Flatpak is an application packaging and distribution framework that bundles applications with their dependencies into a sandboxed container that runs independently of the host OS version.

  • Applications run in an isolated sandbox — limited access to the host system
  • Each application bundles its own runtime libraries — no host dependency conflicts
  • The same Flatpak package runs on RHEL 8, RHEL 9, Fedora, Ubuntu, and others
  • Applications are updated independently of the OS package update cycle
  • Primarily used for desktop GUI applications — not server daemons
Flatpak complements RPM — it does not replace it

RPM is the right tool for system software: services, libraries, command-line tools, and kernel modules. Flatpak is the right tool for desktop applications where cross-distribution compatibility or sandboxing is needed.

Flatpak vs RPM

Feature RPM / dnf Flatpak
Package format RPM — tightly integrated with host OS OCI-based bundle with its own runtime
Dependency model Shared system libraries — resolved by dnf Bundled runtime — self-contained per application
Distribution independence RHEL-specific packages Same package works on any Flatpak-enabled distro
Sandboxing No — full system access Yes — limited access via portal APIs
Disk usage Efficient — shared libraries Larger — each app bundles its runtime
Primary use System software, servers, CLI tools Desktop GUI applications
Repository term Repository (configured in .repo files) Remote (added with flatpak remote-add)
Main source Red Hat CDN / local ISO Flathub (flathub.org)

Installing Flatpak on RHEL

The flatpak package is available in the AppStream repository and must be installed before any Flatpak operations can be performed.

# Install the flatpak package from AppStream
$ sudo dnf install -y flatpak

# Verify the installation
$ flatpak --version
Flatpak 1.14.4

# List currently configured remotes — none yet
$ flatpak remote-list
(no output)

# The flatpak command structure
# flatpak COMMAND [OPTIONS] [ARGUMENTS]
# Common commands: remote-add, remote-list, remote-delete
#                  install, update, uninstall, list, info, run
GNOME Software integration

On systems running the graphical desktop, installing gnome-software provides a graphical interface for Flatpak applications. The flatpak command line is required for the RHCSA exam.

Flatpak Remotes

A remote is Flatpak's term for a repository — a server that hosts Flatpak applications and runtimes. Remotes are added with flatpak remote-add and can be system-wide or per-user.

Scope Flag Where stored Who can use it
System --system (default) /var/lib/flatpak/ All users on the system
User --user ~/.local/share/flatpak/ The current user only
System remotes require sudo

Adding a system-wide remote requires root privileges. Adding a user remote does not. On a shared server, system remotes make Flatpak applications available to all users. For the RHCSA exam, system-wide configuration is the expected scope.

RHCSA Exam Scope

The exam tests adding system-wide remotes with sudo flatpak remote-add. Know the difference between system and user scope and which flag controls it.

Adding the Flathub Remote

Flathub is the primary community repository for Flatpak applications. It hosts thousands of desktop applications from Firefox to LibreOffice to development tools.

# Add Flathub as a system-wide remote
# --if-not-exists prevents errors if already added
$ sudo flatpak remote-add --if-not-exists --system \
    flathub \
    https://dl.flathub.org/repo/flathub.flatpakrepo

# Add Flathub as a user remote (no sudo needed)
$ flatpak remote-add --if-not-exists --user \
    flathub \
    https://dl.flathub.org/repo/flathub.flatpakrepo

# Confirm the remote was added
$ flatpak remote-list
Name     Options
flathub  system,oci

# Show detailed information about the remote
$ flatpak remote-list --show-details
flathub  Flathub  https://dl.flathub.org/repo/  system,oci

The .flatpakrepo File

A .flatpakrepo file is a text descriptor that defines a Flatpak remote. It can be passed to flatpak remote-add as a URL or a local file path.

# Contents of flathub.flatpakrepo — an INI-style descriptor
[Flatpak Repo]
Title=Flathub
Url=https://dl.flathub.org/repo/
Homepage=https://flathub.org
Comment=Central repository of Flatpak applications
Description=Central repository of Flatpak applications
Icon=https://dl.flathub.org/repo/logo.svg
GPGKey=mQINBFlD2sABEADsiUZUO...
# Download and inspect a .flatpakrepo file before adding it
$ curl -O https://dl.flathub.org/repo/flathub.flatpakrepo
$ cat flathub.flatpakrepo

# Add from a local file instead of a URL
$ sudo flatpak remote-add --if-not-exists \
    flathub flathub.flatpakrepo
GPG verification is built in

The .flatpakrepo file embeds the remote's GPG public key. Flatpak uses it automatically to verify every downloaded application and runtime — no separate key import step is needed, unlike RPM repositories.

Managing Remotes

# List all configured remotes
$ flatpak remote-list
Name     Options
flathub  system,oci

# List remotes for all scopes
$ flatpak remote-list --all

# Show the applications available in a remote
$ flatpak remote-ls flathub

# Search available applications across configured remotes
$ flatpak search firefox
Application ID              Version  Branch  Remotes  Description
org.mozilla.firefox         125.0    stable  flathub  Firefox Web Browser

# Disable a remote without removing it
$ sudo flatpak remote-modify --disable flathub

# Re-enable a disabled remote
$ sudo flatpak remote-modify --enable flathub

# Remove a remote
$ sudo flatpak remote-delete flathub

Installing Flatpak Applications

Flatpak applications are identified by a reverse-domain application ID such as org.mozilla.firefox. Each application also has a branch — typically stable.

# Install an application by ID — prompts for confirmation
$ sudo flatpak install flathub org.mozilla.firefox
Installing: org.mozilla.firefox/x86_64/stable from flathub
Downloading runtime org.freedesktop.Platform...
Installing application org.mozilla.firefox...
Is this ok [y/N]: y

# Install without confirmation
$ sudo flatpak install -y flathub org.mozilla.firefox

# Install as the current user (no sudo)
$ flatpak install --user flathub org.mozilla.firefox

# Install from a .flatpakref file (single application descriptor)
$ flatpak install --from firefox.flatpakref
Runtime download on first install

The first time you install a Flatpak application, its runtime environment is downloaded too. This can be several hundred megabytes. Subsequent applications that share the same runtime (for example, all GNOME applications) reuse the already-downloaded runtime.

Listing and Running Applications

# List all installed Flatpak applications
$ flatpak list
Name            Application ID              Version  Branch  Origin   Installation
Firefox         org.mozilla.firefox         125.0    stable  flathub  system

# List only applications (exclude runtimes)
$ flatpak list --app

# Show detailed information about an installed application
$ flatpak info org.mozilla.firefox
ID:             org.mozilla.firefox
Ref:            app/org.mozilla.firefox/x86_64/stable
Origin:         flathub
Installation:   system
Installed size: 248.4 MB

# Run an installed Flatpak application
$ flatpak run org.mozilla.firefox

# List all installed runtimes
$ flatpak list --runtime
Desktop integration

Installed Flatpak applications appear in the GNOME Activities application launcher automatically. The flatpak run command launches the same application from the terminal.

Updating and Removing Applications

Updating

# Update all installed Flatpak applications and runtimes
$ sudo flatpak update

# Update a specific application
$ sudo flatpak update org.mozilla.firefox

# Check what updates are available without installing
$ flatpak remote-ls --updates flathub

Removing

# Remove a specific application
$ sudo flatpak uninstall org.mozilla.firefox

# Remove and clean up unused runtimes in one step
$ sudo flatpak uninstall --unused

# Remove all Flatpak data for a user (home directory data)
$ sudo flatpak uninstall --delete-data org.mozilla.firefox
Clean up unused runtimes

After removing applications, unused runtimes may remain and consume disk space. Run sudo flatpak uninstall --unused periodically to reclaim disk space from runtimes that no installed application requires any more.

Application Data and Permissions

Flatpak applications run in a sandbox with limited access to the host system. Understanding where data is stored and how permissions work helps with troubleshooting and administration.

Where Flatpak stores data

Location Contents
/var/lib/flatpak/System-wide installations — applications and runtimes
~/.local/share/flatpak/Per-user installations
~/.var/app/Per-application user data (settings, cache, profile)

Viewing and overriding sandbox permissions

# Show the sandbox permissions for an application
$ flatpak info --show-permissions org.mozilla.firefox

# Grant an application access to the home directory
$ sudo flatpak override --filesystem=home org.mozilla.firefox

# Reset all permission overrides for an application
$ sudo flatpak override --reset org.mozilla.firefox

Flatpak Command Quick Reference

Task Command
Add a remote (system-wide)sudo flatpak remote-add --if-not-exists remote-name URL
Add a remote (current user)flatpak remote-add --user --if-not-exists remote-name URL
List configured remotesflatpak remote-list
List remotes with detailsflatpak remote-list --show-details
Search for an applicationflatpak search keyword
Install an applicationsudo flatpak install flathub org.app.Name
List installed applicationsflatpak list --app
Show application detailsflatpak info org.app.Name
Run an applicationflatpak run org.app.Name
Update all applicationssudo flatpak update
Remove an applicationsudo flatpak uninstall org.app.Name
Clean up unused runtimessudo flatpak uninstall --unused
Disable a remotesudo flatpak remote-modify --disable remote-name
Remove a remotesudo flatpak remote-delete remote-name

Flatpak in a Restricted Environment

The RHCSA exam environment may have limited or no internet access. These techniques handle Flatpak configuration when direct access to Flathub is not available.

Using a local or institutional mirror

# Add a remote pointing to an internal mirror
$ sudo flatpak remote-add --if-not-exists \
    local-flathub \
    http://mirror.example.com/flatpak/flathub.flatpakrepo

Installing from a .flatpakref file

# A .flatpakref file specifies one application and its source remote
$ cat firefox.flatpakref
[Flatpak Ref]
Name=org.mozilla.firefox
Branch=stable
Url=https://dl.flathub.org/repo/
GPGKey=mQINBFlD2sA...

# Install from the file — adds the remote if not already present
$ flatpak install --from firefox.flatpakref
RHCSA Exam Approach

On the exam, the remote URL will be provided. Use sudo flatpak remote-add --if-not-exists remote-name URL with the given URL. Verify with flatpak remote-list and confirm access with flatpak search.

Common Mistakes

Mistake What goes wrong Correct approach
Adding a remote without --if-not-exists Error if the remote name already exists Always include --if-not-exists to make the command idempotent
Forgetting sudo for system-wide operations Permission denied — system remotes and installs require root Use sudo for system operations; omit it for --user operations
Using a partial application name instead of the full ID Installation fails or installs the wrong application Use the full reverse-domain ID: org.mozilla.firefox, not firefox
Removing an application but not its unused runtimes Disk space not reclaimed — runtimes remain on the system Run sudo flatpak uninstall --unused after removing applications
Confusing remote-list and list remote-list shows configured remotes; list shows installed apps Use remote-list to verify remote configuration; list --app to see installed apps
Not installing the flatpak package first flatpak: command not found Run sudo dnf install flatpak before any Flatpak operations

Knowledge Check

Answer these before moving to the next slide.

  1. What is the difference between a Flatpak remote and an RPM repository? What command adds a Flatpak remote?
  2. Write the command to add the Flathub remote as a system-wide remote, using the URL https://dl.flathub.org/repo/flathub.flatpakrepo, without producing an error if it already exists.
  3. After adding the Flathub remote, write the command to confirm it is listed as an active system remote.
  4. Write the command to search for applications related to the keyword image editor across all configured remotes.
  5. What is the difference between --system and --user scope when adding a Flatpak remote?
  6. After removing a Flatpak application, disk space has not been reclaimed. What command cleans up unused runtimes?

Knowledge Check — Answers

  1. A Flatpak remote is functionally equivalent to an RPM repository — it is a server that hosts applications and their metadata. The key difference is terminology: Flatpak calls them "remotes" and they are added with flatpak remote-add, while RPM repositories are configured in .repo files.
  2. sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
    The --system flag is optional — system is the default scope when using sudo.
  3. flatpak remote-list — the output should show flathub with system in the options column.
  4. flatpak search "image editor" — quotes group the two-word search term so both words are treated as one query.
  5. System scope (--system) stores the remote in /var/lib/flatpak/ and makes it available to all users — requires sudo. User scope (--user) stores it in ~/.local/share/flatpak/ and affects only the current user — no sudo needed.
  6. sudo flatpak uninstall --unused — removes all installed runtimes that are not required by any currently installed application.

Key Takeaways

  1. Flatpak complements RPM — it does not replace it. RPM handles system software, services, and CLI tools. Flatpak handles desktop GUI applications with sandboxing and cross-distribution compatibility. Flatpak calls its repositories remotes.
  2. Add remotes with flatpak remote-add. Use sudo flatpak remote-add --if-not-exists remote-name URL for system-wide access. Verify with flatpak remote-list. The Flathub URL is https://dl.flathub.org/repo/flathub.flatpakrepo.
  3. Install using the full application ID. sudo flatpak install flathub org.mozilla.firefox — always use the reverse-domain ID, not a display name. Verify with flatpak list --app and flatpak info org.app.Name.
  4. System scope requires sudo; user scope does not. System remotes are in /var/lib/flatpak/ and available to all users. User remotes are in ~/.local/share/flatpak/ and affect only the current user. The RHCSA exam tests system-wide configuration.

Graded Lab

  • Install the flatpak package using dnf and confirm the version with flatpak --version
  • Add the Flathub remote as a system-wide remote using the official .flatpakrepo URL. Use --if-not-exists to make the command safe to re-run.
  • Verify the remote is configured with flatpak remote-list --show-details and confirm the URL and system scope appear in the output
  • Search for an application of your choice using flatpak search. Note the full application ID from the output.
  • Install the application using its full ID from the Flathub remote. Confirm installation with flatpak list --app.
  • Run flatpak info on the installed application to view its installed size, origin remote, and installation scope.
  • Remove the application with flatpak uninstall and then run flatpak uninstall --unused to clean up any orphaned runtimes
RHCSA Objective

"Configure access to Flatpak repositories." The core skill is adding a remote with flatpak remote-add and verifying it with flatpak remote-list. Install and list commands confirm the configuration works end-to-end.