How to install Flatpak on CentOS

Flatpak is a package manager that is available for installation on CentOS Linux and all other major Linux distros. Flatpak offers CentOS users an alternative to the official repos and default dnf package manager as a source of software installation. Many applications available in Flatpak currently do not reside in official CentOS repos, making this a big benefit of installing Flatpak.

To use Flatpak on CentOS, we simply need to install the program, add the repos that contain the flatpak packages you wish to install, and then search for and install the packages. Flatpak will also let us manage and update the apps that we install. Flatpak works the same across all Linux distros, so you will only need to learn the command syntax once. The applications in Flatpak are also distribution independent.

In this tutorial, you will see how to install Flatpak package manager on CentOS Linux. Then, we will take you through some basic usage of Flatpak so you can get started with adding repositories and installing custom software of your choice.

In this tutorial you will learn:

  • How to install Flatpak on CentOS
  • How to search for a package in Flatpak
  • How to install a package with Flatpak
How to install Flatpak on CentOS
How to install Flatpak on CentOS
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System CentOS Linux
Software Flatpak package manager
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install Flatpak on CentOS step by step instructions



Twitter icon Follow LinuxConfig.org on Twitter for the latest tips and tricks about Linux!


Follow the step by step instructions below to install Flatpak on CentOS, and get started with using the package manager to search for and install packages, or “flatpaks” on your system.

DID YOU KNOW?
Flatpak is installed by default on CentOS, ever since version 7. Even if you already have the package manager installed, you can still follow along with the steps below to make sure your installed version of Flatpak is up to date, and then add the FlatHub repository to start installing apps.
  1. Installation of Flatpak on CentOS is very simple. Just open up a command line terminal and run the following command:
    $ sudo dnf install flatpak
    
  2. Next, you will need to enable one or more Flatpak repositories (referred to as “remotes” in Flatpak lingo). The biggest and best repository would be FlatHub. Enable it by executing the following command:
    $ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    
  3. In order for the changes to take full effect, you will need to restart your system before using Flatpak:
    $ reboot
    
  4. Once your system boots back up, we are ready to install some applications. There are multiple ways to search for applications to install. One method is to pull up the FlatHub website in your web browser and find something you wish to install.
    Searching for an application in FlatHub
    Searching for an application in FlatHub

    Once you identify the app you want to install, just click the ‘Install’ button in your browser.

  5. Another way to search for an application would be to use the flatpak search command such as in the example below where we search for the ‘gimp’ application. This allows us to stay in our terminal instead of opening a web browser.
    $ flatpak search gimp
    

    Searching for an application in command line terminal
    Searching for an application in command line terminal



  6. After identifying the program to install, use the flatpak install command to complete installation.
    $ sudo flatpak install flathub org.gimp.GIMP
    
    Flatpak is currently installing a package on CentOS
    Flatpak is currently installing a package on CentOS

    The syntax is as follows:

    $ sudo flatpak install [repository] [com].[company].[app]
    
  7. If you want to launch the installed application from terminal:
    $ flatpak run org.gimp.GIMP
    
  8. You can update all of your installed applications with:
    $ sudo flatpak update
    
  9. If, later on, you decide to remove an application, use the following command syntax. In this case, we will remove the GIMP program that we installed earlier.
    $ sudo flatpak uninstall org.gimp.GIMP
    
  10. To get a full list of all of your installed flatpaks, run:
    $ flatpak list
    

    And to get a list of applications only:

    $ flatpak list --app
    

    Getting a list of installed Flatpak applications on CentOS
    Getting a list of installed Flatpak applications on CentOS



Closing Thoughts

In this tutorial, we saw how to install Flatpak on a CentOS Linux system. We also learned how to use Flatpak to add a software repository, install an application, update all installed apps, remove apps, and list the apps that are installed via Flatpak. Users love Flatpak because it is easy to install and run applications, and its built in sandboxing improves stability and security.