How to Install and Use Flatpak on Ubuntu

This guide will show you how to install the Flatpak package manager on Ubuntu.

Installing Flatpak on Ubuntu

Flatpak is an alternative package management system for Linux operating systems, including Ubuntu.

With a Flatpak package, everything is self-contained within its own environment. The application is isolated from any other applications on the system.

The advantage of using something like Flatpak on Ubuntu is that you don’t have to worry about dependencies as a Flatpak is meant to be completely self-contained.

Many pieces of software are distributed as a Flatpak but are not available through the regular Ubuntu package repository.

Over the following sections, we will show you how to install Flatpak and how to use the package manager.

Table of Contents

Installing Flatpak on Ubuntu

With this first section, we will be showing you how to install Flatpak on Ubuntu. This process is relatively straightforward and is done entirely within the terminal.

Before starting this section, you need to open the terminal on Ubuntu. If you are using the desktop flavor of Ubuntu, you can open the terminal by pressing CTRL + ALT + T.

1. With the terminal open, you need to update the package list first step. This ensures we will be installing the latest version of Flatpak available for the current version of Ubuntu.

Run the following command to update the package list.

sudo apt update

2. Now that the package list is updated, we can install Flatpak.

To install the Flatpak package manager to Ubuntu, use the command below in the terminal.

sudo apt install flatpak

3. We can verify that Flatpak is installed by using the following command.

This command will get our newly installed package manager to return its version

flatpak --version

Below you can see that Ubuntu installed Flatpak 1.12.7.

Flatpak 1.12.7

4. With Flatpak installed on Ubuntu, we need to do some initial configuration.

By default, it won’t have any Flatpak repositories configured. To get around this, we will add Flathub, the official Flatpak repository.

To add this repository to Flatpak, you must run the following command within the terminal.

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

5. After installing Flatpak, it is recommended that you restart your Ubuntu device.

You can restart Ubuntu by using the following command.

sudo reboot

Using Flatpak on Ubuntu

This section will show you how you can utilize the Flatpak package manager within Ubuntu.

The primary way to control Flatpak is to utilize the terminal, so ensure you have that open before continuing.

Searching for Packages using Flatpak

We will first show you how you can use Flatpak to search for available packages to install to Ubuntu.

Now there is a couple of ways you can do this. One is through a website like Flathub, and the other uses the terminal.

Using Flathub to Find Flatpak Packages

The first is to utilize the official Flathub website. The website is the better way to find packages as it gives you all the commands you need to use and is far easier to browse.

1. To start this section, you will need to go to Flathub website within your favorite web browser.

We will focus on searching for packages in this guide, but the website offers a few different ways to find packages.

In our example, we will use the search bar at the top of the page to look for “Discord“.

Flathub Website Homepage

2. With any luck, by using the search box, you will find the Flatpak you want to install to Ubuntu.

In our example, Discord was available as the very first result.

Find Discord on Flathub

3. Once you are within a particular Flatpak’s, page you can scroll to the bottom to find all the commands you need.

First, you will find the command you need to use to install that particular Flatpak to Ubuntu (1.).

The second command is what you will use to run the Flatpak after it has been installed (2.).

Flatpak Install Commands on Flathub for Ubuntu

Searching for Packages Through the Terminal

The other way is to utilize the command-line interface. When using the interface, it will search all of the repositories that you have added.

1. To search for a package you can install to Ubuntu using Flatpak, you can utilize the following command.

Make sure that when using this command, you replace “APPLICATION” with the app you are searching for.

sudo flatpak search APPLICATION

Please note that when you first search for a Flatpak, the process can take some time.

2. For example, if you wanted to search for “Discord” within the Flatpak repository, we would utilize the command below.

sudo flatpak search Discord

Below is an example of the data returned by searching for an application. The three things that you will be interested in here are “Remotes“, “Name” and “Application ID“.

You install an application using the “remote” and “Application ID“. However, you can use the “Name” instead of the “Application ID” if you want Flatpak to find similar packages during installation.

Name   Description                                  Application ID     Version       Branch Remotes
Disco… Messaging, Voice, and Video Client           …iscordapp.Discord 0.0.18        stable flathub
Disco… A graphical overlay for Discord voice chat.  ….discover_overlay 0.5.3         stable flathub
WebCo… A Discord and Fosscord web-based client mad… …acingbat3.webcord 3.3.0         stable flathub
Cider  An open source and community oriented Apple… sh.cider.Cider     v1.5.1        stable flathub

Installing a Flatpak Package

Installing a Flatpak package is a reasonably straightforward process. You only need the application’s ID and the name of the repository it is being installed from.

You can find the application ID from the search function or the Flathub website.

1. Below, you can see the command for installing packages.

First, use “flatpak install” followed by the remote name (flathub if you are using Flathub). then finally, the application ID. (e.g. com.discordapp.Discord)

sudo flatpak install REMOTE APPLICATIONID

2. For example, if we were to use Flatpak to install Discord on Ubuntu, we would use the following command.

We use “flatuhub” as the remote and “com.discordapp.Discord” as the application ID.

sudo flatpak install flathub com.discordapp.Discord

3. Flatpak will search to verify that your specified application is available.

If it finds the package, you will get a message asking if you want to install that particular package.

To begin the installation, you must type “Y” and then press the ENTER key.

Looking for matches…
Required runtime for com.discordapp.Discord/x86_64/stable (runtime/org.freedesktop.Platform/x86_64/21.08) found in remote flathub
Do you want to install it? [Y/n]:

4. After confirming you want to install that specific package, you will get a list of permissions that this package needs.

You will see if the app wants access to the host system from these permissions. In addition, you will be prompted with a list of additional packages that Flatpak will install alongside the one you chose.

To proceed with the installation process, you will need to type Y, and then press ENTER.

com.discordapp.Discord permissions:
    ipc      network      pulseaudio      x11      devices      file access [1]      dbus access [2]      tags [3]

    [1] xdg-download, xdg-pictures:ro, xdg-videos:ro
    [2] com.canonical.AppMenu.Registrar, com.canonical.Unity.LauncherEntry, com.canonical.indicator.application, org.freedesktop.Notifications,
        org.kde.StatusNotifierWatcher
    [3] proprietary


        ID                                             Branch            Op           Remote            Download
 1.     org.freedesktop.Platform.GL.default            21.08             i            flathub           < 131.3 MB
 2.     org.freedesktop.Platform.Locale                21.08             i            flathub           < 325.8 MB (partial)
 3.     org.freedesktop.Platform.openh264              2.0               i            flathub             < 1.5 MB
 4.     org.freedesktop.Platform                       21.08             i            flathub           < 200.3 MB
 5.     com.discordapp.Discord                         stable            i            flathub            < 81.7 MB

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

5. Once the installation has been completed, you will see Flatpak print the following message to the Ubuntu terminal.

You can now run the application, a task which we will cover in the next section.

Installation complete.

Running a Flatpak Package on Ubuntu

Running a Flatpak package on Ubuntu is slightly different from most. Instead of running an application directly, you will need to tell Flatpak to run that application using its “Application ID”.

1. To achieve this, you use “flatpak” followed by “run“, and finally the ID for the application you want to run.

The syntax for this command is as we have shown below.

latpak run APPLICATIONID

2. For example, if we want to run the Discord application that we installed using Flatpak, we can use the following command.

flatpak run com.discordapp.Discord

3. After using the above command, we can see how Flatpak started Discord on our Ubuntu device.

It now functions just like any other application would within Ubuntu.

Discord Flatpak Running on Ubuntu

Listing Installed Flatpaks

Listing the Flatpak’s that you have installed to Ubuntu is a straightforward process and can be done with a quick command.

1. To list all the applications you have installed using Flatpak, use the command below.

Please note that the command will list packages that were installed as a dependency.

flatpak list

2. Below, you can see the result from listing our installed Flatpak’s.

You can see that we have Discord installed alongside a few other packages that Flatpak installed alongside it.

Name              Application ID                    Version  Branch Installation
Discord           com.discordapp.Discord            0.0.18   stable system
Freedesktop Plat… org.freedesktop.Platform          21.08.14 21.08  system
Mesa              ….freedesktop.Platform.GL.default 21.3.8   21.08  system
openh264          org.freedesktop.Platform.openh264 2.1.0    2.0    system

Uninstalling a Flatpak Package on Ubuntu

You can easily uninstall any package installed through Flatpak on Ubuntu. All you need to know is the application ID of what you want to remove.

1. When removing a package, you use “flatpak“, followed by “remove” and then the ID of the application you want to remove.

sudo flatpak remove APPLICATIONID

2. For this example, we will uninstall the Discord package by using the application ID “com.discordapp.Discord“.

sudo flatpak remove com.discordapp.Discord

3. When uninstalling a Flatpak package on Ubuntu you will get a list of all packages that will be removed during the process.

To continue the uninstallation process, you must type in “Y” and then press the ENTER key.

        ID                            Branch        Op
 1.     com.discordapp.Discord        stable        r

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

4. Once the uninstall process completes, you will see the following message within the terminal.

Uninstall complete.

Updating Packages Through Flatpak

Flatpak allows you to easily update any of its packages by using a simple command. In addition, it will check each installed package to see if a new version is available from its respective repository.

1. To update all of the Flatpak packages you have installed on Ubuntu, you can use the following command. All we need to do is pass the “update” option to Flatpak.

sudo flatpak update

If you have no packages to be updated, you will see the following message appear within the terminal.

Looking for updates…
Nothing to do.

2. Alternatively, if there are updates available for any of your packages, they will be listed within the terminal.

To update all the listed packages, type in Y and press the ENTER key.

Looking for updates…


        ID                        Branch    Op    Remote    Download
 1.     org.gtk.Gtk3theme.Yaru    3.22      i     flathub   < 191.5 kB

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

3. If Flatpak successfully updates your packages, you should see the following message appear in the terminal.

Update complete.

Conclusion

Within this guide, you were taught how to install Flatpak on Ubuntu and how to use it to install other packages.

Flatpak is a neat package manager that allows you to install “Flatpaks”. A Flatpak, as mentioned earlier, is a self-contained package containing all the needed components to run that piece of software.

Please comment below if you have questions about installing and using Flatpak on Ubuntu.

To learn more, we have plenty of other Ubuntu guides. We also have general Linux tutorials to learn how to use the underlying system.

Leave a Reply

Your email address will not be published.