Linux offers a range of options for managing packages. Traditionally, these options were confined to only package managers like APT,  DNF or YUM.

App stores, which are available in major distributions, provided great relief for users who are averse to working on the command-line. They provide a simple graphical interface that allows users to install, update, or remove installed software applications on Linux.

Table of Contents
    How to Install and Run Flatpak Applications image 1

    Installing Software Packages in Linux

    Over time, managing software packages in Linux presented a host of complex challenges. 

    First, not all applications could be found in App Stores. For you to install them, you had to download and run the corresponding rpm or debin packages. Sometimes, when running these packages, you would encounter dependency issues which would often result in errors during the installation.

    How to Install and Run Flatpak Applications image 2

    Secondly, while you could successfully install a software package in one Linux system, say Debian, the installation would totally fail in Ubuntu or another Debian-based operating system. 

    Given the setbacks that users encountered in managing software packages across different environments, innovative ways of handling packages were developed.

    Distribution Agnostic Software Packages

    Given the set of challenges that came with installing packages across multiple Linux distributions, a distribution-agnostic system of handling packages that would allow users to install and manage packages,  regardless of the distribution they were running, was needed. 

    In light of this, Canonical, Ubuntu’s publisher, thought of snaps which are compressed applications that bundle with their own libraries and dependencies. The snapd daemon enables users to install, update and remove snap packages across all major distributions that have snap support. Canonical has availed Snapcraft which is a snap repository that hosts over 4000 snaps. 

    How to Install and Run Flatpak Applications image 3

    Additionally, there is AppImage, a packaging system that allows users to install portable applications without requiring root privileges. The other alternative is Flatpak, which we will talk about and seek to understand in a better way. 

    Flatpak, What Is It?

    Flatpak is a package management system that aims to enable  users and developers to install and manage software packages on Linux systems regardless of the Linux distribution, runtime, dependencies and the type of package management. A flatpak application runs in a sandboxed environment. This is an isolated environment that is bundled with all the dependencies, libraries and everything that is needed for the app to run smoothly. 

    The uniformity in distribution and packaging  gives developers an easy time when developing and testing applications.

    To take advantage of flatpaks, you need to have flatpak enabled on your system. Without much further ado, let’s dive into this and see how flatpak can be installed in  major Linux distributions.

    Enable Flatpak in Red Hat / CentOS / Fedora

    For RedHat / CentOS 8 and Fedora 22 and later versions, invoke the command below to enable flatpak:

    $ sudo dnf install flatpak

    For earlier versions of Red Hat and CentOS use the YUM package manager as shown:

    $ sudo yum install flatpak

    Enable Flatpak in Debian/Ubuntu 

    If you are running the latest versions on Debian and Ubuntu, then the following commands will come in handy in getting flatpak on your system:

    $ sudo apt install flatpak

    For Linux Mint and other Ubuntu derivatives, i.e. Elementary OS, add the Alexander Larsson PPA first. ( Pssst! , this is the creator of the Flatpak packaging system).

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

    Then update your system packages and run the commands shown:

    $ sudo apt update
    $ sudo apt install flatpak

    Enable Flatpak in ArchLinux / Manjaro

    If you are an Arch Linux or Arch-based distro lover, use the  pacman package manager to enable Flatpak support.

    $ sudo pacman -S install flatpak

    Enable Flatpak in OpenSUSE

    On OpenSUSE run the command as shown:

    $ sudo zypper install flatpak

    How to Install and Run Flatpak Applications

    Flatpak applications, just like snaps, are hosted on a repository. The most popular repository is the FlatHub repository that has applications in broad categories such as audio & video, graphics & photography, developer tools, utilities and so much more.

    To enable Flathub repository to enable you install applications from Flathub, issue the command below:

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

    You can verify the repository installed by running the command:

    $ flatpak remotes
    How to Install and Run Flatpak Applications image 4

    Once the repository is added, you can search for the availability of an application  as shown.

    $ flatpak search app-name

    For example, we are going to search for the Skype desktop client as shown:

    $ flatpak search skype
    How to Install and Run Flatpak Applications image 5

    The output gives you details about the flatpak application such as the Application ID, the version, the branch and a brief summary of the application.

    To install the flatpak application, run the syntax as follows:

    $ sudo flatpak install remotes Application-ID

    Here, the command to install Skype client will be:

    $ sudo flatpak install flathub com.skype.Client

    Your system will contact flathub, search for the flatpak application and install it. Simply follow the prompts by typing ‘y’ and pressing ENTER. The installation can take quite a bit of time, and this might be a great opportunity to grab a cup of tea or rush to take a break.

    How to Install and Run Flatpak Applications image 6

    You can list all the installed flatpak apps by running:

    $ flatpak list
    How to Install and Run Flatpak Applications image 7

    Running a flatpak is quite simple. Simply use the syntax:

    $ sudo flatpak run Application-ID

    For example, in our case, this will be

    $ sudo flatpak run com.skype.Client
    How to Install and Run Flatpak Applications image 8

    If you need to update flatpak applications, you can do so in one single command as shown.

    $ flatpak update

    Finally, if you don’t need the flatpak application anymore, you can remove it using the syntax:

    $ flatpak uninstall Application-ID

    For instance, to remove Skype, execute the command:

    $ sudo flatpak uninstall com.skype.Client
    How to Install and Run Flatpak Applications image 9

    Closing Thoughts

    Clearly, Flatpak, alongside snap, has revolutionized package management in Linux. Flatpak provides a level-playing ground where users can rest assured that the applications will run across any Linux distribution that has Flatpak support without any issues.

    Additionally, Flatpaks guarantee future compatibility and easy integration with pre-existing applications on your system. If you are having challenges with installing apps on your system, Flathub comes highly recommended as a decent package management system.