How to Install Flatpak on Ubuntu 24.04, 22.04 or 20.04

Flatpak is a groundbreaking application distribution system tailored for Linux operating systems. It offers a unified solution for software management. Below are some of the key features of Flatpak:

  • Enhanced Security: Through sandboxing, Flatpak isolates applications, bolstering security and minimizing potential inter-app conflicts.
  • Universal Compatibility: Designed with cross-distribution support, Flatpak ensures developers can craft a single package that is compatible across diverse Linux distributions.
  • Direct Distribution: Flatpak’s decentralized approach empowers developers to distribute software directly, eliminating the dependency on centralized repositories.
  • Stable Runtime: Flatpak guarantees a consistent runtime environment by bundling dependencies, mitigating potential dependency-related issues.
  • Streamlined Updates: Flatpak offers developers and end-users a simplified update mechanism, ensuring timely access to the latest software iterations.
  • Version Flexibility: Flatpak’s parallel installation feature facilitates the concurrent installation of multiple application versions, ideal for testing or version comparisons.

This guide illustrates the steps to integrate Flatpak into your Ubuntu system. The upcoming sections will detail the installation process for the CLI commands, leveraging Ubuntu’s default apt repository or the official Launchpad team Flatpak PPA.

Update Ubuntu Before Flatpak Installation

The first task is to update your system to ensure all existing packages are up to date before installing.

sudo apt update && sudo apt upgrade

Method 1: Install Flatpak via Default APT Repository

Installing Flatpak on Ubuntu can be done through different methods. The first method we will discuss is installing it using the Ubuntu repository. It is important to note that by default, Ubuntu keeps Flatpak in its repository. Still, it is not installed by default due to its competition with Snap, the parent company of Ubuntu.

To install Flatpak using the Ubuntu repository, you can use the following command in a Linux terminal:

sudo apt install flatpak

This command prompts you to enter your root password before installing Flatpak. After you enter your password, the installation process will begin.

Once installed, you can add the Flathub repository, which is the primary repository for Flatpak applications, by running the following command:

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

This command will add the Flathub repository to your Flatpak installation, allowing you to easily search for and install applications from the Flathub repository.

Method 2: Install Flatpak via Flatpak Team APT PPA

The second method of installing Flatpak on Ubuntu uses the “Flatpak” team LaunchPAD PPA, which contains the latest stable and development versions of Flatpak. This method is highly recommended as Canonical, Ubuntu’s parent company, has been putting more pressure on using Snap over APT, especially against Flatpak.

Option 1: Import Flatpak stable PPA:

sudo add-apt-repository ppa:flatpak/stable -y

Option 2: Import Flatpak development PPA:

sudo add-apt-repository ppa:flatpak/development -y

After importing the PPA, run an APT update to ensure that the changes are reflected:

sudo apt update

Now, install Flatpak by running the following command:

sudo apt install flatpak

This command will prompt you to enter your root password before installing Flatpak. After entering your password, the installation process will begin.

Once installed, you can add the Flathub repository, which is the primary repository for Flatpak applications, by running the following command:

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

This command will add the Flathub repository to your Flatpak installation, allowing you to search and install applications from the Flathub repository easily.

Furthermore, once you have installed the Flatpak version using the PPA, you can check the installed version by using the “apt-cache policy” command, as shown below:

apt-cache policy flatpak

As shown in the guide, the installation process installed the development version of Flatpak, which was version 1.15.3 at the time of writing. It is important to note that this version may be slightly ahead of the Flatpak PPA stable version and significantly ahead of Ubuntu’s default version, which is 1.12.7 and considered outdated.

Basic Flatpak Commands

This section will explain how to use Flatpak on your Ubuntu system in more detail.

Adding a Remote Repository

Flatpak uses remote repositories to download and install applications. To add a remote repository, use the following command:

flatpak remote-add --if-not-exists <name> <URL>

For example, to add the Flathub repository, which is the primary repository for Flatpak applications, use the following command:

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

Installing Applications

To install an application using Flatpak, use the following command:

flatpak install <application-name>

For example, to install the GIMP image editing software, use the following command:

flatpak install org.gimp.GIMP

Updating Applications

To update an application that was installed using Flatpak, use the following command:

flatpak update <application-name>

For example, to update GIMP, use the following command:

flatpak update org.gimp.GIMP

Uninstalling Applications

To uninstall an application that was installed using Flatpak, use the following command:

flatpak uninstall <application-name>

For example, to uninstall GIMP, use the following command:

flatpak uninstall org.gimp.GIMP

Listing Installed Applications

To list all the applications that were installed using Flatpak, use the following command:

flatpak list

Searching for Applications

To search for an application in the Flatpak repository, use the following command:

flatpak search <search-term>

For example, to search for the LibreOffice productivity suite, use the following command:

flatpak search libreoffice

Listing Remote Repositories

To list all the remote repositories that are currently configured, use the following command:

flatpak remote-list

Checking for Updates

To check for updates to applications installed using Flatpak, use the following command:

flatpak update

Updating the Flatpak System

To update the Flatpak system itself, use the following command:

flatpak update --system

Info on Applications

To get information about an application, such as its version and other details, use the following command:

flatpak info <application-name>

For example, to get information about GIMP, use the following command:

flatpak info org.gimp.GIMP

Running Applications

To run an application that was installed using Flatpak, use the following command:

flatpak run <application-name>

For example, to run GIMP, use the following command:

flatpak run org.gimp.GIMP

Sideload an Application

To sideload an application that was not downloaded from a repository, use the following command:

flatpak install <path-to-application>

Exporting an Application

To export an application that was installed using Flatpak to a file, use the following command:

flatpak export <application-name

Exporting an Application

To export an application that was installed using Flatpak to a file, use the following command:

flatpak export <application-name> <filename>

For example, to export GIMP to a file called gimp.flatpak, use the following command:

flatpak export org.gimp.GIMP gimp.flatpak

Importing an Application

To import an application that was exported using Flatpak, use the following command:

flatpak install <filename>

For example, to import the gimp.flatpak file that was exported earlier, use the following command:

flatpak install gimp.flatpak

List Files in an Application

To list the files that were installed as part of an application, use the following command:

flatpak list-files <application-name>

For example, to list the files installed as part of GIMP, use the following command:

flatpak list-files org.gimp.GIMP

Check Application Permissions

To check the permissions that an application has, use the following command:

flatpak permissions <application-name>

For example, to check the permissions for GIMP, use the following command:

flatpak permissions org.gimp.GIMP

Change Application Permissions

To change the permissions that an application has, use the following command:

flatpak override <application-name> --filesystem=<directory>

For example, to permit GIMP to access a directory called MyPhotos, use the following command:

flatpak override org.gimp.GIMP --filesystem=/home/user/MyPhotos

Remote Update

To update all remote repositories, use the following command:

flatpak update --appstream

Update a Single Remote

To update a single remote repository, use the following command:

flatpak update <remote-name>

Remove a Remote

To remove a remote repository, use the following command:

flatpak remote-delete <remote-name>

Run Application in Sandbox

To run an application in a sandbox environment, use the following command:

flatpak run --sandbox <application-name>

For example, to run GIMP in a sandbox environment, use the following command:

flatpak run --sandbox org.gimp.GIMP

Create an Application Bundle

To create an application bundle that can be distributed and installed on other systems, use the following command:

flatpak build-bundle <directory> <bundle-file>

For example, to create a bundle for GIMP, use the following command:

flatpak build-bundle org.gimp.GIMP gimp.bundle

List Installed Runtimes with Flatpak on Ubuntu

To list all the runtimes that are currently installed, use the following command:

flatpak list-runtime

List Available Runtimes

To list all the runtimes that are available in the repository, use the following command:

flatpak list-runtime -a

List Extensions

To list all the extensions that are currently installed, use the following command:

flatpak list-extension

List Available Extensions

To list all the extensions that are available in the repository, use the following command:

flatpak list-extension -a

These are just some of the essential Flatpak commands to help you manage and deploy applications on your Ubuntu system.

Conclusion

Flatpak provides a robust and versatile solution for managing and distributing applications on Ubuntu Linux. By utilizing Ubuntu’s repository or the Flatpak team PPA, users can access the latest stable or development versions of applications consistently and securely. Flatpak’s containerized approach isolates applications and their dependencies, reducing the risk of conflicts and enhancing the system’s overall stability. In summary, Flatpak offers a reliable and efficient means of managing applications on Ubuntu Linux, contributing to a better user experience.

Useful Links

Here are some valuable links related to using Flatpak on an Ubuntu system:

  • Flatpak Official Website: Visit the official Flatpak website for information about the software deployment system, its features, and download options.
  • Flathub: Explore Flathub to find and install various applications packaged with Flatpak.
  • Flatpak Documentation: Access comprehensive documentation for detailed guides on installing, configuring, and using Flatpak.
  • Flatpak FAQ: Find answers to frequently asked questions about using Flatpak.

These links provide further information to help you effectively use Flatpak on Ubuntu.

Joshua James
Follow me
Latest posts by Joshua James (see all)