Share on Social Media

Learn how to effortlessly install Flatpak on Linux 9 with our comprehensive guide. Discover the streamlined process to enable Flatpak support, unlocking a vast repository of applications for your Linux system.. #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.

Features in Flatpak

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.

What is Flatpak Hub?

The Flatpak Hub, commonly referred to as Flathub, is a centralized repository for Flatpak applications. It serves as a platform where developers can distribute their Flatpak packages, making them easily accessible to users of various Linux distributions. Flathub offers a wide range of applications, including productivity tools, games, multimedia software, and more.

Users can browse the Flathub website or access it directly through the Flatpak command-line interface to discover and install applications. Flathub simplifies the process of finding and installing software by providing a centralized hub for Flatpak packages, promoting ease of use and software discovery in the Flatpak ecosystem.

Flatpak vs Snap

Flatpak and Snap are both package management systems designed to simplify software distribution and management on Linux systems, but they have some differences:

  • Packaging Format:
  • Flatpak: Flatpak uses a format called Flatpak bundles (“.flatpakref” files) and repositories to distribute software. Flatpak packages are designed to be sandboxed and isolated from the rest of the system, ensuring security and compatibility.
  • Snap: Snap packages are self-contained bundles that include all dependencies needed to run the software. They are also sandboxed to enhance security and portability across different Linux distributions.
  • Distribution Support:
  • Flatpak: Flatpak is supported across various Linux distributions, including Ubuntu, Fedora, Debian, and others. It aims to provide a universal packaging format that works consistently across different distributions.
  • Snap: Snap is developed by Canonical and is primarily associated with Ubuntu and its derivatives. While it can be installed and used on other distributions, its integration with Ubuntu is particularly strong.
  • Package Discovery:
  • Flatpak: Flatpak repositories, such as Flathub, serve as centralized locations for discovering and installing Flatpak applications. Users can add multiple repositories to access a wide range of software.
  • Snap: Snap Store is the primary storefront for discovering and installing Snap packages. While Snap packages can be distributed through other channels, the Snap Store provides a centralized platform for users to find software.
  • Community and Development:
  • Flatpak: Flatpak is developed as an open-source project with contributions from various developers and organizations. It follows open standards and encourages community involvement.
  • Snap: Snap is developed primarily by Canonical, the company behind Ubuntu. While it is also open-source, the development process is more centralized compared to Flatpak.

In summary, both Flatpak and Snap offer convenient ways to install and manage software on Linux systems, with their own packaging formats, distribution support, and ecosystem characteristics. The choice between them often depends on user preferences, distribution compatibility, and the availability of specific applications in their respective repositories.

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 repositories, now you can install your required software easily.

First, search for your required software in Flathub repositories. 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.

Video: How to install Flatpak on Linux

YouTube player

Final Thoughts

Embarking on the journey to install Flatpak on Linux 9 opens up a world of streamlined software management. With Flatpak’s robust sandboxing and compatibility features, accessing a diverse array of applications becomes effortless. Whether you’re a developer or an everyday user, integrating Flatpak enriches your Linux experience with a versatile toolkit for software exploration and innovation. If you are new to Linux command-line, then we suggest that you should attend online training: Linux command line for beginners

Leave a Reply

Your email address will not be published. Required fields are marked *