Site icon DesignLinux

How to Install and Use Flatpak on Linux

In Linux, there are many avenues for installing a software package. You can use the package managers such as APT for Debian-based distributions and YUM for RHEL-based distributions. If the packages are not available in the official repositories, you can use the available PPAs ( For Debian distributions ) or install them using DEB or RPM packages. If you are not a fan of using the terminal, the Software Center can give you a much easier way of installing applications. If everything fails, you still have an option of building from source.

Be that as it may, a few challenges exist. The software center may not always have the application you are looking for and installing from PPAs may yield errors or compatibility issues. Additionally, building from source requires a higher level of expertise and is not a beginner-friendly way for newcomers to Linux.

In light of such challenges, a universal way of installing packages comes highly recommended in order to save time and avoid errors arising from compatibility issues. Canonical was the first to implement such an idea in the form of snap packages. Snaps are cross-distribution, containerized, and dependency-free software packages that simplify the installation of software applications.

Along with snaps, came flatpak, which is yet another universal packaging system.

Flatpaks

Written in C, a flatpak is a package management utility that allows users to install and run applications in a sandboxed or isolated environment. Just like snaps, flatpak aims at simplifying the management of software packages across various distributions. A single flatpak can be installed in any Linux distribution that supports Flatpaks without any modification.

How to Install Flatpak in Linux Distributions

In this guide, we focus on how you can install Flatpak and use it across various Linux distributions. Installing Flatpak is a 2-step procedure. First, you need to install Flatpak using your distribution’s package manager and later add the Flatpak repository ( Flathub ) from where applications will be installed.

Install Flatpak on Ubuntu and Mint

By default, Flatpak is supported on Ubuntu 18.04 and Mint 19.3 and later versions. You can confirm this by running the command:

$ sudo apt install flatpak
Install Flatpak in Ubuntu

Install Flatpak on Debian and Debian-based Distros

For other Debian-based distributions such as Zorin, Elementary, and other distros, add the PPA shown and execute the command below:

$ sudo add-apt-repository ppa:alexlarsson/flatpak 
$ sudo apt update 
$ sudo apt install flatpak

Install Flatpak on RedHat and Fedora

For Fedora and RHEL/CentOS 8 run the command.

$ sudo dnf install flatpak

For earlier versions, RHEL/CentOS 7 use the yum package manager to install flatpak.

$ sudo yum install flatpak

Install Flatpak on OpenSUSE

To enable Flatpak on OpenSUSE invoke the command:

$ sudo zypper install flatpak

Install Flatpak on ArchLinux / Manjaro

Finally, to enable Flatpak on Arch Linux and its flavors, invoke the command:

$ sudo pacman -S flatpak

Once Flatpak is installed, the next step will be to enable Flatpak’s repository from where applications will be downloaded.

How to Add Flathub Repository in Linux

The next step will be to add Flatpak’s repository from where we will download and install applications. Here. we are adding Flathub since it’s the most popular and widely used repository.

To add Flathub to your system. run the command below.

$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Adding Flathub Repository

How to Use Flatpak in Linux

Before installing an application from the repository, you can search for its availability on Flathub using the syntax:

$ flatpak search application name

For example, to search Flathub for Spotify, run the command:

$ flatpak search spotify

The results will give you the Application ID, Version, Branch, Remotes, and a brief description of the software application.

Search Apps in Flathub

To install the application from the repository, use the syntax:

$ flatpak install [remotes] [Application ID]

In this case, to install Spotify, run the command

$ flatpak install flathub com.spotify.Client
Install Apps from Flathub

To run a flatpak application, execute the command:

$ flatpak run [Application ID]

For example,

$ flatpak run com.spotify.Client

In my case, this had the effect of launching the Spotify application.

Run Flatpak Application

To list the flatpak packages residing on your system, run the command:

$ flatpak list
List Flatpak Applications

To uninstall an application, use the syntax:

$ flatpak uninstall [Application ID]

For example, to remove Spotify, run:

$ flatpak uninstall com.spotify.Client

To update all flatpak packages, run:

$ flatpak update

In my case, all flatpaks were up to date, so no changes were made.

Update Flatpak Applications

Finally, to check the version of flatpak you are using, execute:

$ flatpak --version
Check Flatpak Version
Conclusion

Flatpak goes a long way in providing access to additional software for your system. This is made possible by the Flathub repository which contains a huge collection of flatpak applications.

Exit mobile version