How to Install and Use Flatpak on Ubuntu 22.04

Choose a different version or distribution

Introduction

Before we begin talking about how to install Flatpak on Ubuntu 22.04, let's briefly understand – What is Flatpak?

Flatpak is a popular software packaging and distribution system that allows developers to create and distribute applications easily. It provides a secure and sandboxed environment, ensuring compatibility across various Linux distributions.

Users can install and run Flatpak applications on their systems, regardless of the underlying Linux distribution, which makes software management simpler and more efficient. With Flatpak, developers can deliver their software directly to users, and users can enjoy a wide range of applications without worrying about compatibility issues.

In this tutorial, you will install Flatpak on Ubuntu 22.04. We will also address a few FAQs on how to install Flatpak on Ubuntu 22.04.

Advantages of Flatpak

  1. Cross-Distribution Compatibility: Flatpak applications work seamlessly across different Linux distributions.
  2. Easy Software Management: Flatpak simplifies software installation, updates, and removal.
  3. Enhanced Security: Flatpak uses sandboxing, providing a secure environment for applications.
  4. Simplified Dependency Management: Flatpak eliminates dependency conflicts, ensuring smooth installation and operation.
  5. Direct Application Delivery: Developers can distribute their software directly to users, reaching a wider audience.

Method1:

Step 1: Log in to your server via SSH

You must first use SSH to access your Ubuntu 22.04 VPS:

ssh root@IP_Address -p Port_number

The IP address and SSH port number of your server must be substituted for "IP_Address" and "Port_number," respectively. Moreover, change "root" to the username of the system user who has sudo access.

Use the following command to see if the correct version of Ubuntu is installed on your server:

lsb_release -a

This is the output that it will return.

Output

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy

In this article, we'll run the shell commands using "root." Make sure to add "sudo" before the commands if you want to run them using your normal user account with sudo rights.

Step 2: Update the system

Make sure all of the Ubuntu 22.04 packages are installed on the server are up to date before you begin. You can accomplish this by executing the subsequent commands:

apt update -y
apt upgrade -y

Step 3. Install Flatpak

Ubuntu 22.04 already comes with Flatpak installed. Thus, all we need to do is run the command below to install it.

apt install flatpak

After installation, run the following command to see the Flatpak version.

flatpak --version

Step 4. Use Flatpak

After installing Flatpak successfully in the previous step, we must now link Flatpak to a repository. Hundreds of applications that are readily installable on any Linux distribution can be found on Flathub. Use the following command to enable the Flathub repository and install flatpak apps from Flathub:

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

We can now search for and install apps after turning on Flathub. We'll attempt to install Signal Messenger, for instance. Let's search it with this command.

flatpak search signal

Installing an application using Flatpak requires the syntax flatpak install Application ID. We must pay attention to the Application ID in the search result after finding the application we wish to install. The relevant application ID for the program we want to install must be copied. The Signal messenger application in this instance is called "org.signal.Signal." Thus, the command that needs to be executed is:

flatpak install org.signal.Signal

Now you can use flatpak to search for apps and install them. You can run the following to find out which apps are installed on your computer through flatpak:

flatpak list

The command flatpak uninstall Application ID would be used to remove the flatpack apps. In order to remove Signal Messenger, you can use the following command:

flatpak uninstall org.signal.Signal

In order to free up disk space, we occasionally need to delete unnecessary files. Using the following command, we can eliminate flatpak runtimes:

flatpak uninstall --unused

You can use the command below to see the options for other flatpak-related commands.

flatpak --help

Alternatively, use this command to read more about the manual.

man flatpak

Method 2:

Update Ubuntu Before Flatpak Installation

Before installing, the first thing to do is update your system to make sure all installed packages are current.

sudo apt update && sudo apt upgrade

Install Flatpak on Ubuntu 22.04 via Default APT Repository

Several techniques are available for installing Flatpak on Ubuntu. Installing it through the Ubuntu repository is the first approach we'll cover. The fact that Ubuntu maintains Flatpak in its repository by default is significant to note. Because of its rivalry with Snap, the parent company of Ubuntu, it is still not installed by default.

The following command can be used in a Linux terminal to install Flatpak using the Ubuntu repository:

sudo apt install flatpak

Before installing Flatpak, this command will ask you to enter your root password. Once your password has been entered, the installation will start.

After installation, use the following command to add the Flathub repository, which serves as the main repository for Flatpak applications:

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

With the help of this command, you can easily search and install apps from the Flathub repository by adding the repository to your Flatpak installation.

Install Flatpak on Ubuntu 22.04 via Flatpak Team APT PPA

The LaunchPAD PPA, maintained by the "Flatpak" team, is the source of the most recent stable and development versions of Flatpak and is used in the second method of installing Flatpak on Ubuntu. Given that Canonical, the company that created Ubuntu, has been pushing for the use of Snap instead of APT, particularly in opposition to Flatpak, this approach is strongly advised.

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

Run an APT update after importing the PPA to make sure the modifications are reflected:

sudo apt update

Now, use the following command to install Flatpak:

sudo apt install flatpak

Before installing Flatpak, this command will ask you to enter your root password. Once your password has been entered, the installation will start.

After installation, use the following command to add the Flathub repository, which serves as the main repository for Flatpak applications:

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

You can easily search and install apps from the Flathub repository by using this command to add the Flathub repository to your Flatpak installation.

Additionally, you can use the "apt-cache policy" command to verify the installed version of the Flatpak version after installing it using the PPA, as demonstrated below:

apt-cache policy flatpak

The installation procedure installed the development version of Flatpak, which at the time of writing was version 1.15.3, as indicated in the guide. It's crucial to remember that this version might be marginally better than the stable version available on the Flatpak PPA and much better than the out-of-date Ubuntu default version, 1.12.7.

Basic Flatpak Commands To Work With Ubuntu 22.04

More information about using Flatpak on your Ubuntu system can be found in this section. Here are some crucial Flatpak commands to help you use Flatpak efficiently. Flatpak is an extremely useful tool for organizing and distributing applications on Linux systems.

Adding a Remote Repository with Flatpak on Ubuntu

Flatpak downloads and installs apps from remote repositories. The command to add a remote repository is as follows:

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

For instance, run the following command to add the Flathub repository, which serves as the main repository for Flatpak applications:

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

Installing Applications with Flatpak on Ubuntu

Use this command to install an application using Flatpak:

flatpak install <application-name>

For instance, run the following command to install the GIMP image editing program:

flatpak install org.gimp.GIMP

Updating Applications with Flatpak on Ubuntu

Use the following command to update an application that was installed using Flatpak:

flatpak update <application-name>

For instance, run the following command to update GIMP:

flatpak update org.gimp.GIMP

Uninstalling Applications with Flatpak on Ubuntu

Use the following command to remove an application that was installed using Flatpak:

flatpak uninstall <application-name>

For instance, run the following command to remove GIMP:

flatpak uninstall org.gimp.GIMP

Listing Installed Applications with Flatpak on Ubuntu

Use the following command to see a list of every application that was installed using Flatpak:

flatpak list

Searching for Applications with Flatpak on Ubuntu

Use the following command to look for an application in the Flatpak repository:

flatpak search <search-term>

For instance, use the following command to look for the LibreOffice productivity suite:

flatpak search libreoffice

Listing Remote Repositories with Flatpak on Ubuntu

Use the following command to get a list of all the configured remote repositories:

flatpak remote-list

Checking for Updates with Flatpak on Ubuntu

Use the following command to see if any updates are available for any apps that were installed using Flatpak:

flatpak update

Updating the Flatpak System with Flatpak on Ubuntu

Use this command to update the Flatpak system directly:

flatpak update --system

Info on Applications with Flatpak on Ubuntu

Use the following command to obtain details about an application, including version and other information:

flatpak info <application-name>

For example, run the following command to obtain information about GIMP:

flatpak info org.gimp.GIMP

Running Applications with Flatpak on Ubuntu

Use the following command to launch an application that was installed using Flatpak:

flatpak run <application-name>

For instance, use the following command to launch GIMP:

flatpak run org.gimp.GIMP

Sideload an Application with Flatpak on Ubuntu

Use the following command to sideload an application that wasn't downloaded from a repository:

flatpak install <path-to-application>

Exporting an Application with Flatpak on Ubuntu

Use the following command to export a Flatpak-installed application to a file:

flatpak export <application-name

Exporting an Application with Flatpak on Ubuntu

Use the following command to export an application to a file that was installed using Flatpak:

flatpak export <application-name> <filename>

For instance, use the following command to export GIMP to a file named gimp.flatpak:

flatpak export org.gimp.GIMP gimp.flatpak

Importing an Application with Flatpak on Ubuntu

Using Flatpak to export an application, import it with the following command:

flatpak install <filename>

For example, run the following command to import the previously exported gimp.flatpak file:

flatpak install gimp.flatpak

List Files in an Application with Flatpak on Ubuntu

Use the following command to get a list of the files installed with an application:

flatpak list-files <application-name>

For instance, use the following command to list the files that are installed with GIMP:

flatpak list-files org.gimp.GIMP

Check Application Permissions with Flatpak on Ubuntu

Use the following command to see the permissions that an application has:

flatpak permissions <application-name>

For instance, run the following command to verify the permissions for GIMP:

flatpak permissions org.gimp.GIMP

Change Application Permissions with Flatpak on Ubuntu

Use the following command to modify an application's permissions:

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

For instance, use the following command to allow GIMP access to the MyPhotos directory:

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

Remote Update with Flatpak on Ubuntu

Use this command to update all remote repositories:

flatpak update --appstream

Update a Single Remote with Flatpak on Ubuntu

Use this command to update a single remote repository:

flatpak update <remote-name>

Remove a Remote with Flatpak on Ubuntu

Use the following command to remove a remote repository:

flatpak remote-delete <remote-name>

Run Application in Sandbox with Flatpak on Ubuntu

To launch an application within a sandbox, utilize the subsequent command:

flatpak run --sandbox <application-name>

For instance, use the following command to launch GIMP in a sandbox environment:

flatpak run --sandbox org.gimp.GIMP

Create an Application Bundle with Flatpak on Ubuntu

Use the following command to create an application bundle that can be installed and distributed on different systems:

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

To generate a bundle for GIMP, for instance, utilize the subsequent command:

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

List Installed Runtimes with Flatpak on Ubuntu

Use the following command to get a list of all the installed runtimes at this time:

flatpak list-runtime

List Available Runtimes with Flatpak on Ubuntu

Use the following command to get a list of every runtime that is available in the repository:

flatpak list-runtime -a

List Extensions with Flatpak on Ubuntu

Use the following command to see a list of all the installed extensions:

flatpak list-extension

List Available Extensions with Flatpak on Ubuntu

Use the following command to get a list of every extension that is available in the repository:

flatpak list-extension -a

These are just a few of the most important commands for Flatpak that you will need to manage and install apps on your Ubuntu computer.

FAQs to Install Flatpak on Ubuntu 22.04

Are there any additional dependencies required?

Yes, you will need to install the software center integration package to enable the integration of Flatpak apps with the system software center.

Can I install Flatpak without using the command line? 

Yes, you can install Flatpak by using the graphical interface of the Software Center or package manager, making it user-friendly for non-technical users.

How do I add a Flatpak remote repository? 

You can add additional Flatpak remote repositories through the Software Center or by using Flatpak command-line tools to add the desired repository.

How can I search for Flatpak applications? 

You can search for Flatpak applications through the Software Center by typing relevant keywords in the search bar and filtering the results to include Flatpak applications.

How can I update Flatpak applications? 

Flatpak applications can be easily updated through the Software Center or package manager, which will notify you when updates are available and allow you to install them.

Are Flatpak applications compatible with other Linux distributions? 

Yes, one of the advantages of Flatpak is its compatibility across various Linux distributions. Flatpak applications can run on different distributions without compatibility issues.

Conclusion

We hope this tutorial helped you understand how to install Flatpak on Ubuntu 22.04.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.