Flatpak is a tool for deploying and managing software packages on the Linux operating system. It provides an isolated environment where users can run applications without affecting other parts of their computers.
With Flatpaks, installing an application is like pulling it into your local repository. Links have then generated that point from the right places in Filesystem to where you can find these files–these hard links will be efficient for disk space since they’re simple compared with doing things through traditional methods.
Most Ubuntu LTS users know that the distribution focuses on stability over newer features, especially once the LTS has aged after its initial release with packages being frozen. For example, you may want to install the latest version of an application such as Discord, VLC, Spotify, or Ubuntu does not have the application together, making often third-party package managers use it as a backup.
In the following tutorial, you will learn how to install Flatpak on Ubuntu 22.04 LTS Jammy Jellyfish and enable Flathub to search, install, maintain or remove Flatpak applications as an alternative the standard APT package manager, Launchpad PPA’s and especially Snap packages from Snapcraft.io.
Table of Contents
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
Ubuntu 22.04 features Flatpak by default on its standard stable repository. To begin the installation, use the following command.
sudo apt install flatpak -y
Flathub is a popular destination to search for applications that you can install on a whim, enable this by using the following command.
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
How to Use Flatpak
The tutorial will run over some of the most common commands using Flatpak.
The first command you should use is the help command to familiarise yourself with the number of options you have, and even some Flatpak users may find commands that they did not know.
Usage: flatpak [OPTION…] COMMAND Builtin Commands: Manage installed applications and runtimes install Install an application or runtime update Update an installed application or runtime uninstall Uninstall an installed application or runtime mask Mask out updates and automatic installation pin Pin a runtime to prevent automatic removal list List installed apps and/or runtimes info Show info for installed app or runtime history Show history config Configure flatpak repair Repair flatpak installation create-usb Put applications or runtimes onto removable media Finding applications and runtimes search Search for remote apps/runtimes Running applications run Run an application override Override permissions for an application make-current Specify default version to run enter Enter the namespace of a running application ps Enumerate running applications kill Stop a running application Manage file access documents List exported files document-export Grant an application access to a specific file document-unexport Revoke access to a specific file document-info Show information about a specific file Manage dynamic permissions permissions List permissions permission-remove Remove item from permission store permission-set Set permissions permission-show Show app permissions permission-reset Reset app permissions Manage remote repositories remotes List all configured remotes remote-add Add a new remote repository (by URL) remote-modify Modify properties of a configured remote remote-delete Delete a configured remote remote-ls List contents of a configured remote remote-info Show information about a remote app or runtime Build applications build-init Initialize a directory for building build Run a build command inside the build dir build-finish Finish a build dir for export build-export Export a build dir to a repository build-bundle Create a bundle file from a ref in a local repository build-import-bundle Import a bundle file build-sign Sign an application or runtime build-update-repo Update the summary file in a repository build-commit-from Create new commit based on existing ref repo Show information about a repo Help Options: -h, --help Show help options Application Options: --version Print version information and exit --default-arch Print default arch and exit --supported-arches Print supported arches and exit --gl-drivers Print active gl drivers and exit --installations Print paths for system installations and exit --print-updated-env Print the updated environment needed to run flatpaks --print-system-only Only include the system installation with --print-updated-env -v, --verbose Show debug information, -vv for more detail --ostree-verbose Show OSTree debug information
How to Search for Applications with Flatpak
Flatpak search feature can be handy in the terminal. Ideally, you would want to find the name plus the application ID. This still can be done in the terminal but visually not as easy as using the web browser and grabbing the id directly.
flatpak search telegram
How to Install Applications from Flatpak Search
Once you have found the application, you can install it in the tutorial case Telegram using the following command.
flatpak install telegram
Option 1 usually is the best choice, and some flatpacks have no options; some have many.
How to Install Applications with Flatpak direct from Flathub
A more desirable method to install applications is grabbing the direct command from Flathub.
As above, the command in your terminal would be.
flatpak install flathub org.telegram.desktop
For users that want to install Flatpak applications quickly, you can add
-y syntax to end as you would an APT package.
flatpak install flathub org.telegram.desktop -y
How to Run Flatpak Application
For most users, you would run the Flatpak installed application from the show applications menu and select the icon. But for users that would like to launch from the terminal, use the following.
flatpak run org.telegram.desktop
How to List Installed Flatpak Applications
Sometimes it can be easy to forget what applications you have installed with Flatpak. A handy feature is to use the list command to print what is currently installed in your terminal along with the build version, branch, and application id.
How to Update Flatpak Applications
By default, updates are handled automatically, but you can open a terminal and use the following command to check manually.
How to Remove Flatpak Applications
Use the following command for users who want to remove Flatpak applications in your terminal.
flatpak uninstall --delete-data org.telegram.desktop
Remove (Uninstall) Flatpak
For users that no longer wish to have Flatpak installed, use the following command to remove all installed applications first.
flatpak uninstall --all
Next, remove any leftovers runtimes.
flatpak uninstall --unused
Now remove Flatpak directly from your Ubuntu 22.04 system.
sudo apt autoremove flatpak --purge -y
With this process, you have removed Flatpak in full.
Comments and Conclusion
In the tutorial, you have learned how to install Flatpak Manager on Ubuntu 22.04 LTS Jammy Jellyfish.
Overall, Flatpak is a more popular third-party installation manager and can be seen installed by default on many other Linux distributions. Overall, APT architecture is more desirable, but Flatpaks can come in handy for users who need an updated version or have no other alternative to quickly find the application elsewhere and do not want to use snaps.
Performance-wise you may notice a slight difference given Flatpak’s are in containers, but this should hardly be noticeable on modern systems and depending on what applications you are using.