What Is a Flatpak in Linux, and How Do You Install One?

Flatpaks are a convenient, distribution-agnostic, way to install Linux applications. With application sandboxing and bundled dependencies, they also avoid dependency hell. Most distributions offer Flatpak support but on Ubuntu you’ll need to install the Flatpak framework first.

Flatpaks are a distribution-agnostic way to install applications onto your Linux computer. But if your distribution already has a native way to install applications, why would you ever bother to use Flatpaks?

What Is a Flatpak?

Flatpak is the name of a package format used to easily and reliably install applications on any Linux distribution. Just like AppImages and Snaps, Flatpaks containers come with all required dependencies, and apps installed as Flatpaks can self-update as well. You can find them

The Package Management Holy Grail

All Linux distributions need a way to install applications. That’s why tools like Debian’s apt, Fedora’s dnf, and Arch’s pacman exist. Out of necessity, they all do the same thing in slightly different ways.

They let the user install software packages by pulling specially wrapped packages back from a repository. The wrapping on the package includes information about how the files that make up the package—executables, data files, man pages, and so on—should be copied to different locations in the Linux file system, and what permissions should be applied to them.

From a developer’s point of view, wrapping and releasing a version of their application in each of the different package manager formats is a big task. Even if they decide to only support the top three or four formats, it can still leave them with a development drain and a sizeable support overhead.

Developers would much rather work on their own code than wrestle with the intricacies of a set of package formats. How much better it would be if there was a universal installation format. Developers could package their applications once, and users of any distribution could use it.

The closest we had to that holy grail was source code, which is the very antithesis of a wrapped application. It means you download the source code and other components of the application, and build it on your own machine. As a method, it works but it’s neither fast nor particularly convenient, and you need to know what you’re doing. That puts it out of reach for most newcomers to the Linux world.

Flatpaks are an attempt to create a universal package format. AppImages and Snaps are competing projects with the same goals. Flatpaks do more than reduce the pressure on developers to support multiple package formats. They contain both the application and all its dependencies, so the application won’t fail to run because of a missing or mismatched library, for example. Applications installed as Flatpaks also get automatic updates.

On top of that, Flatpak applications run in a sort of mini-container, sandboxed from other applications—including other versions of the same application. You can install multiple releases of a single application without the dependencies of one version interfering with one another. That makes life easier for the developer, and smoother for the user.

Installing Flatpak Support On Ubuntu

Canonical (the company behind Ubuntu) is keen to push its users towards Snaps, its own version of a universal installer. So much so, that it removed out-of-the-box support for Flatpak in Ubuntu 23.04 Lunar Lobster, and agreed with the alternate Ubuntu flavors such as Kubuntu, Lubuntu, and Ubuntu Studio that they’ll remove Flatpak support too.

Linux being what it is, of course, you can install Flatpak support right back into Ubuntu. Flatpaks are supported out-of-the-box by Manjaro and Fedora, so if you’re using one of those distributions, you can skip to the next section.

To install Flatpak on Ubuntu, type:

sudo apt install flatpak
Installing Flatpak support on Ubuntu

There’s a GNOME plugin that lets the Ubuntu Software application install Flatpaks. But there’s a catch. Since Ubuntu 20.04, the Software application itself is a Snap, so it won’t play nicely with the Flatpak plugin. You can still install the plugin in, but it pulls in a different, DEB-based, version of the Software application. So you’ll end up with two version of the Software application.

You don’t need the plugin if you’re going to work with Flatpaks on the command line, and the Flatpak command line is very simple. Still, if you do want the plugin, the command you need is:

sudo apt install gnome-software-plugin-flatpak
Installing the GNOME Flatpak plugin in Ubuntu

We need to tell the Flatpak system where to look for Flatpak packages. We can add the Flathub repository with this command:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Setting up Flathub as a Flatpak repository

After rebooting your computer you can check that Flatpak is correctly installed and responding by checking its version number.

flatpak --version
Checking the Flatpak version

Installing a Flatpak Application

Installing an application is straightforward, once you know the Flatpak name of the package that you want. There’s two ways to discover this.

Searching on the Flathub website for the package is one way. We’ll use Discord as an example.

Searching for the Discord application on Flathub

Once you’ve located it, scroll to the bottom of the page. You’ll see the command you need to install the application.

The installation command on the Flathub page for the Discord application

This uses the three-part Flatpak name for the application. Note that we don’t need to include “flathub” in our command (because we’ve already added the Flathub repository to our system) but you do need to use all three parts of the package name.

We can also search on the command line. To search for packages related to Discord, use this command:

flatpak search discord
Searching for the Discord application using the flatpak command in a terminal window

You’ll see a list of all the packages that contain your search term. It’s best to do this with your terminal window stretched to a wider than normal size, so that the table entries are not truncated.

Now that we know the package name we can issue the command to install it.

flatpak install com.discordapp.Discord
Installing the Discord Flatpak

Any dependencies or other requirements are installed along with the Flatpak. A progress bar shows how close to completion the installation is.

The list of packages that will be installed along with the Discord Flatpak

When the installation has completed, you’re returned to command line prompt. We can now run our new application.

Running a Flatpak Application

The command to run the application is just like the installation command with the word “install” replaced with “run.”

flatpak run com.discordapp.Discord
Launching the Discord Flatpak

The application starts, and Discord goes though its usual upgrade checks.

Discord performing its update checks and applying updates

Before long, you’ll see the Discord application open on your desktop.

The Discord Flatpak application on the Ubuntu desktop

In GNOME, now that we’ve launched our application, its icon will appear in the dashboard. Right-clicking the icon displays a menu. Select “Pin to Dash” to create a launcher in the dashboard.

Adding the Dsicord icon to the Ubuntu Dash launcher

You’ll be able to launch the application from here in the future.

Listing Installed Flatpak Applications

To see the applications you’ve installed with Flatpak, use the list option. We’ve also used the --app option so that only applications we’ve installed are listed.

flatpak list --app
Listing the installed Flatpak applications

Without the --app option, all the Flatpak framework modules and dependencies are listed, too.

Uninstalling a Flatpak Application

Uninstalling an application is as easy as running one. Just use the word “uninstall” with the flatpak command.

flatpak uninstall com.discordapp.Discord
Uninstalling the Discord Flatpak

The application is removed from your system, and a confirmation message is displayed.

Should You Use Flatpaks?

The application sandboxing and the practical guarantee that an application will run are attractive characteristics of Flatpaks. However, because a Flatpak contains all the dependencies the application needs, their footprint is larger. The start time of the application is slightly increased , too.

Whether you use Flatpaks or the native package manager that came with your Linux might come down to whether the applications you’re looking for are in your distribution’s repositories.

I’ve never met anyone who uses Flatpaks exclusively—nor AppImages or Snaps, for that matter. You’ll probably settle on a combination of what works for you: your default package manager, Flatpaks, Snaps, or Appimages.

If a particular application isn’t in your distribution’s repositories, and you don’t want to build from source, a Flatpak is probably your best bet. I find them to be much faster than AppImages or Snaps.