How to Install Flatpak on Ubuntu 22.04 or 20.04

Flatpak, a groundbreaking application distribution system, is tailored for Linux operating systems, offering a unified solution for software management. Suppose you aim to install Flatpak on Ubuntu 22.04 Jammy Jellyfish or Ubuntu 20.04 Focal Fossa. In that case, you’re on the right path to unlocking many features that enhance software deployment and management.

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 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: With Flatpak, developers, and end-users experience 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 seamlessly. Whether you’re using Ubuntu 22.04 Jammy Jellyfish, Ubuntu 20.04 Focal Fossa, or even other stable short-term Ubuntu releases, the upcoming sections will detail the installation process using CLI commands, leveraging either 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

Install Flatpak on Ubuntu 22.04 or 20.04 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 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.

Install Flatpak on Ubuntu 22.04 or 20.04 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, the parent company of Ubuntu, has been putting more pressure on using Snap over APT, especially against Flatpak.

Option 1: Import Flatpak stable PPA for Ubuntu:

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

Option 2: Import Flatpak development PPA for Ubuntu:

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
Screenshot showing the apt-cache policy command output for Flatpak development version on Ubuntu 22.04 or 20.04 Linux.
Output of the apt-cache policy command for Flatpak development version on Ubuntu 22.04 or 20.04 Linux.

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 To Work With Ubuntu 22.04 or 20.04

This section will explain how to use Flatpak on your Ubuntu system in more detail. Flatpak is a powerful tool for managing and deploying applications on Linux systems, and here are some essential Flatpak commands that can help you use Flatpak effectively.

Adding a Remote Repository with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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

flatpak list

Searching for Applications with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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

flatpak remote-list

Checking for Updates with Flatpak on Ubuntu

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

flatpak update

Updating the Flatpak System with Flatpak on Ubuntu

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

flatpak update --system

Info on Applications with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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

flatpak install <path-to-application>

Exporting an Application with Flatpak on Ubuntu

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

flatpak export <application-name

Exporting an Application with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

To update all remote repositories, use the following command:

flatpak update --appstream

Update a Single Remote with Flatpak on Ubuntu

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

flatpak update <remote-name>

Remove a Remote with Flatpak on Ubuntu

To remove a remote repository, use the following command:

flatpak remote-delete <remote-name>

Run Application in Sandbox with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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 with Flatpak on Ubuntu

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

flatpak list-runtime -a

List Extensions with Flatpak on Ubuntu

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

flatpak list-extension

List Available Extensions with Flatpak on Ubuntu

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.

Your Mastodon Instance
Share to...