How to install Flatpak on Linux 9

Share on Social Media

In this Linux tutorial, you will learn how to install Flatpak on Linux 9 or other Red Hat based Linux distributions. #centlinux #linux #flatpak

What is Flatpak?:

Flatpak is a software distribution and package management system that provides a way to package, distribute, and run applications on various Linux-based operating systems. It is designed to offer a universal packaging format that works across different Linux distributions.

Flatpak uses sandboxing technology to isolate applications from the underlying system and dependencies, allowing them to run independently with minimal impact on the host system. This approach provides several benefits, including improved security, better software reliability, and the ability to run applications across different Linux distributions without the need for specific package formats.

Here are some key features and concepts associated with Flatpak:

  • Flatpak packages: Applications packaged using Flatpak are called “Flatpaks” or “Flatpak packages”. A Flatpak package contains the application and its dependencies, bundled together as a single package. This allows applications to run with a consistent environment regardless of the underlying Linux distribution.
  • Sandboxing: Flatpak utilizes sandboxing techniques to isolate applications from the host system. Sandboxing restricts an application’s access to system resources, ensuring that it operates within predefined boundaries and minimizing the potential for security vulnerabilities or conflicts with other software.
  • Runtime environment: Flatpak relies on “runtimes” to provide a standardized set of libraries and dependencies required for applications to run. Runtimes are shared components that can be used by multiple Flatpak applications, reducing duplication and ensuring consistent behavior.
  • Flatpak repositories: Flatpak packages are distributed through repositories. Repositories serve as centralized locations where users can discover, download, and update Flatpak applications. Various repositories exist, including the official Flatpak repository, as well as third-party repositories maintained by different organizations and communities.
  • Software management: Flatpak includes command-line tools and graphical frontends that enable users to install, update, and remove Flatpak applications easily. Users can also manage application permissions and access to system resources through these tools.
  • Cross-distribution compatibility: One of the key advantages of Flatpak is its ability to run applications across different Linux distributions. By using a standardized packaging format and sandboxing, Flatpak eliminates many of the compatibility issues that can arise when running software designed for specific distributions.

Overall, Flatpak provides a way to distribute and run Linux applications in a more portable and secure manner, making it easier for developers to reach a wider audience and for users to access and manage a diverse range of software on their Linux systems.

Video to install Flatpak on Linux:

YouTube player

Environment Specification:

We are using a minimal Rocky Linux 9 virtual machine with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – Rocky Linux release 9.1 (Blue Onyx)
  • Hostname – flatpak-01.centlinux.com
  • IP Address – 192.168.116.128/24

Prepare your Linux Server:

Login as root user on your Rocky Linux server by using a ssh client.

Execute following command at Linux terminal to update software packages on your Linux operating system.

# dnf update -y

Note down versions of Linux Kernel and Linux OS, that are being used in this tutorial.

# cat /etc/rocky-release
Rocky Linux release 9.1 (Blue Onyx)

# uname -r
5.14.0-162.23.1.el9_1.x86_64

Install Flatpak on Linux:

In Rocky Linux 9, Flatpak software is available in standard yum repositories.

By using dnf command, search for flatpak software package.

# dnf search flatpak
Last metadata expiration check: 0:05:26 ago on Thu 11 May 2023 07:45:02 PM PKT.
======================== Name Exactly Matched: flatpak =========================
flatpak.x86_64 : Application deployment framework for desktop apps
======================= Name & Summary Matched: flatpak ========================
flatpak-builder.x86_64 : Tool to build flatpaks from source
flatpak-libs.x86_64 : Libraries for flatpak
flatpak-libs.i686 : Libraries for flatpak
flatpak-selinux.noarch : SELinux policy module for flatpak
flatpak-session-helper.x86_64 : User D-Bus service used by flatpak and others
flatpak-spawn.x86_64 : Command-line frontend for the org.freedesktop.Flatpak
                     : service
flatpak-xdg-utils.x86_64 : Command-line tools for use inside Flatpak sandboxes
=========================== Summary Matched: flatpak ===========================
xdg-desktop-portal.x86_64 : Portal frontend service to flatpak

More details about flatpak package can be checked by using following Linux command.

# dnf info flatpak
Last metadata expiration check: 0:05:50 ago on Thu 11 May 2023 07:45:02 PM PKT.
Available Packages
Name         : flatpak
Version      : 1.12.7
Release      : 2.el9
Architecture : x86_64
Size         : 1.7 M
Source       : flatpak-1.12.7-2.el9.src.rpm
Repository   : appstream
Summary      : Application deployment framework for desktop apps
URL          : http://flatpak.org/
License      : LGPLv2+
Description  : flatpak is a system for building, distributing and running
             : sandboxed desktop applications on Linux. See
             : https://wiki.gnome.org/Projects/SandboxedApps for more
             : information.

You can install Flatpak on Linux by executing following command.

# dnf install -y flatpak

To verify that Flatpak is successfully installed, you can run the following command to display the version.

# flatpak --version
Flatpak 1.12.7

Repositories are termed as remotes in Flatpak. Execute flatpak command display list of remotes that are added in your Linux server.

# flatpak remotes

If the output is empty, it indicates that no remote has been added yet.

Execute following command to add Flathub repository.

# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

There may be a warning related to XDG_DATA_DIRS environment variable. It is a stationary warning due to not setting environment variable for current session, so you can safely ignore it.

Again check the installed Flatpak repositories.

# flatpak remotes
Name    Options
flathub system

You can see that, Flathub repository has been added successfully.

For a more verbose output, you can also use –show-details switch with above command.

# flatpak remotes --show-details
Name    Title   URL                          Collection ID Subset Filter Priority Options … … Homepage             Icon
flathub Flathub https://dl.flathub.org/repo/ -             -      -      1        system  … … https://flathub.org/ https://dl.flathub.org/repo/logo.svg

Install a software using FlatPak:

After setting Flathub repository, now you can install your required software easily.

First, search for your required software in Flathub repository. For this purpose, execute following command at Linux terminal.

# flatpak search wireshark
Name    Description                                                    Application ID               Version Branch Remotes
Wiresh… Wireshark is the world's foremost protocol analyzer            org.wireshark.Wireshark      4.0.5   stable flathub
Hotwire Hotwire allows you to study network traffic of a few popular … …hub.emmanueltouzery.hotwire 0.2.3   stable flathub

Note down the ‘Application ID’ of the software and use it to install that software.

# flatpak install org.wireshark.Wireshark
Looking for matches…
Required runtime for org.wireshark.Wireshark/x86_64/stable (runtime/org.kde.Platform/x86_64/5.15-22.08) found in remote flathub
Do you want to install it? [Y/n]: Y

org.wireshark.Wireshark permissions:
    ipc                   fallback-x11       wayland      x11      dri      file access [1]
    dbus access [2]

    [1] home:ro, xdg-config/kdeglobals:ro, xdg-public-share
    [2] com.canonical.AppMenu.Registrar, org.kde.KGlobalSettings, org.kde.kconfig.notify


        ID                                           Branch              Op         Remote          Download
 1.     org.freedesktop.Platform.GL.default          22.08               i          flathub         < 142.3 MB
 2.     org.freedesktop.Platform.GL.default          22.08-extra         i          flathub         < 142.3 MB
 3.     org.freedesktop.Platform.openh264            2.2.0               i          flathub         < 944.3 kB
 4.     org.kde.KStyle.Adwaita                       5.15-22.08          i          flathub           < 6.6 MB
 5.     org.kde.Platform.Locale                      5.15-22.08          i          flathub         < 354.8 MB (partial)
 6.     org.kde.Platform                             5.15-22.08          i          flathub         < 323.7 MB
 7.     org.wireshark.Wireshark.Locale               stable              i          flathub          < 63.4 kB (partial)
 8.     org.wireshark.Wireshark                      stable              i          flathub          < 45.0 MB

Proceed with these changes to the system installation? [Y/n]:Y

...
...
...

        ID                                           Branch              Op         Remote          Download
 1. [✓] org.freedesktop.Platform.GL.default          22.08               i          flathub         142.0 MB / 142.3 MB
 2. [✓] org.freedesktop.Platform.GL.default          22.08-extra         i          flathub           9.5 MB / 142.3 MB
 3. [✓] org.freedesktop.Platform.openh264            2.2.0               i          flathub           1.2 MB / 944.3 kB
 4. [✓] org.kde.KStyle.Adwaita                       5.15-22.08          i          flathub           6.6 MB / 6.6 MB
 5. [✓] org.kde.Platform.Locale                      5.15-22.08          i          flathub          18.0 kB / 354.8 MB
 6. [✓] org.kde.Platform                             5.15-22.08          i          flathub         371.6 MB / 323.7 MB
 7. [✓] org.wireshark.Wireshark.Locale               stable              i          flathub           1.8 kB / 63.4 kB
 8. [✓] org.wireshark.Wireshark                      stable              i          flathub          50.1 MB / 45.0 MB

Installation complete.

Your required software has been installed successfully with all dependencies.

Conclusion – Install FlatPak on Linux:

In this Linux tutorial, you have learned how to install FlatPak on Linux 9 or other Red Hat based Linux distributions. If you are new to Linux command-line, then we suggest that you should attend online training: Linux command line for beginners