Flatpak is another leading technology (after Snap) that provides a platform-independent framework for packaging, distributing, and running Linux applications.
The core applications and related libraries are packaged in containers to provide a consistent and secure environment for applications to run on various Linux distributions.
In this article, you will see the comparison between Flatpak and its alternative Snap, how to install Flatpak on your preferred Linux system, and how to use the flatpak command.
|Flatpak and Flathub
|Root or Sudo Privileges
|Ubuntu, Manjaro, Fedora, etc.
Why Does Flatpak Outshine Its Counterpart, Snap?
Flatpak and Snap stand as two prominent technologies for distributing and executing software applications within the Linux ecosystem.
While Snap has sparked discussions due to its canonical background, both of these technologies have their own advantages.
|Flatpak-packaged apps work seamlessly across diverse Linux distributions without any modifications needed.
|Snap prioritizes security through robust sandboxing, tightly minimizing potential vulnerabilities.
|While Flathub is a popular centralized repository for Flatpak applications, developers can establish personal repositories alongside Flathub, enhancing distribution control for Flatpak apps.
|Snap package exclusively distributed via Snap Store, which is centralized and managed by Canonical (the company behind Ubuntu).
|Flatpak empowers developers to package specific runtime library versions with apps, minimizing compatibility concerns.
|Snap packages are auto-updated in the background for the latest versions, eliminating the need for manual updates.
|Flatpak enhances font rendering and system consistency through default access to system fonts.
|Snap employs AppArmor to enhance security through confinement.
|Flatpak applications exhibit potentially improved performance in specific scenarios, as indicated by user feedback and benchmarks.
|Snap packages include runtime libraries, contributing to larger package sizes compared to Flatpak.
|Flatpak provides heightened flexibility, enabling developers to tailor runtime and sandboxing settings for intricate use cases.
|Snap boasts seamless integration with Ubuntu and GNOME, particularly within Ubuntu-based distributions.
It’s important to note that both Flatpak and Snap have their own strengths and are continuously developing. Your choice would depend on the application you want to use as an end user.
Now, let’s see how you can install Flatpak on your preferred Linux system.
How to Install Flatpak on Linux
The well-known distributions — AlmaLinux, CentOS, Clear Linux, Elementary OS, Endeavour OS, Endless OS, KDE Neon, Linux Mint, MX Linux, Pop!_OS, and Zorin OS — come with Flatpak preinstalled, eliminating the need for any manual setup.
However, installing Flatpak on other distributions is a breeze – a straightforward two-step process. Just follow the provided steps tailored to your specific Linux distribution.
Installing Flatpak on a Debian or Ubuntu System
Execute the following command to effortlessly install the most up-to-date version of Flatpak on your Linux system:
$ sudo apt install flatpak
If your current Ubuntu version is not 22.04 or 22.10, please include the following repository and proceed with the installation:
$ sudo add-apt-repository ppa:alexlarsson/flatpak
$ sudo apt update
$ sudo apt install flatpak
If you’re utilizing the GNOME desktop environment on Debian or Ubuntu-based Linux distributions, enhance your experience by installing the following plugin:
$ sudo apt install gnome-software-plugin-flatpak #Optional
It will let GNOME Software Center to manage and display Flatpak applications, enabling you to effortlessly browse, install, and keep Flatpak packages up-to-date directly through the user-friendly GNOME Software interface.
Installing Flatpak on a Red Hat or Fedora System
To install Flatpak in Fedora and RHEL/CentOS 8, run the following command:
$ sudo dnf install flatpak
To install Flatpak in an earlier version of RHEL/CentOS 7, use the YUM package manager:
$ sudo yum install flatpak
Installing Flatpak on an Arch or Manjaro System
Install Flatpak using this distribution’s default Pacman package manager.
$ sudo pacman -S flatpak
Installing Flatpak on an OpenSUSE-Based System
To install the latest version of Flatpak on your OpenSUSE system, simply execute the following Zypper command:
$ sudo zypper install flatpak
How to Add a Flathub Repository in Linux
Once the Flatpak installation is finished, your next task will be to add the Flatpak repository. This repository will serve as your source for downloading and installing applications.
Execute the following command to add the official Flathub (the most popular and widely used repository) to your Linux system.
$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Now, check out the next section to get a hands-on example of the Flatpak command’s usage.
How to Use Flatpak in Linux
Flatpak usage is simple and straightforward, as shown in the following few examples.
List Installed Applications
The following command will provide a list of all Flatpak applications (not runtimes) currently installed on your system.
$ flatpak list
Here are a few additional examples showcasing various methods for listing applications and runtimes:
$ flatpak list --runtime #List Only the Runtime
$ flatpak remote-ls #List Applications and Runtime from All Remote Repository
Search for an Application
To locate an application within the newly added repository (such as “
Flathub“), simply provide the application name in the following command:
$ flatpak search vlc
Install an Application from Flathub
You can easily install applications like “
VLC” from the Flathub repository by providing the repository name and the Application ID.
$ flatpak install flathub org.videolan.VLC
Run an Application
After installing the application, you can effortlessly find it in your application menu or launch it by specifying its Application ID in the following command:
$ flatpak run org.videolan.VLC
Info about an Installed Application
The following command will provide you with a list of information related to the installed application, such as ID, Ref, Arch, Branch, Version, License, Origin, Collection, Installation, Application size, Runtime, Sdk, and more.
$ flatpak info org.videolan.VLC
Update All Installed Applications
Ensure that all your Flatpak applications stay up-to-date by executing the following command:
$ flatpak update
Update a Specific Application
Instead of updating all Flatpak applications, you have the option to selectively update specific Flatpak applications to tailor your updates according to your preferences.
$ flatpak update org.videolan.VLC
Uninstall an Application
To uninstall an unused Flatpak application, simply provide its Application ID.
$ flatpak uninstall org.videolan.VLC
List Available Remotes
The following command will provide a list of all the currently configured remote repositories.
$ flatpak remotes
Add a Repository
At the beginning of this article, you learned how to add a Flathub repository. However, it’s not the only available repository; you can add other repositories, such as Flathub-beta, Fedora, Gnome-Nightly, or RHEL, depending on the distributions.
Let’s say you want to add a Flathub beta repository known for providing beta builds of applications. These builds require a specific level of testing and are designed to be largely functional and accessible to non-developers and end-users.
To add a Flathub beta repository, you can specify the repo name and url, as shown.
$ flatpak remote-add --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo
To install the Flatpak application from the Flathub-beta repository, simply specify the added repository name and application ID in the following way:
$ flatpak install flathub-beta <application-id>
Remove a Repository
To remove an unused remote repository, just provide its repository name in the following command:
$ flatpak remote-delete flathub-beta
And here comes the end.
I hope you find this article useful. If you have any questions or queries related to this article, feel free to tell us in the comment section.
Till then, peace!