How to add repository using Flatpak

To get started installing software with Flatpak, you will first need to add one or more software repositories. Flatpak uses these repositories (“remotes” in Flatpak terms) to search for and install software from centralized locations. This behavior should seem familiar to Linux users, as it is exactly how traditional package managers work as well.

Developers can create their own Flatpak repos to allow access to their software across all major Linux distros, since Flatpak is distribution independent. You may find yourself in need of adding a Flatpak repo in order to gain access to software not available in your default system repositories, or to subscribe to application download and updates from a particular developer that has chosen to release their software through Flatpak.

In this tutorial, we will take you through the step by step instructions to add a repository to Flatpak on a Linux system. Then, we will show how to search the newly configured repository for software that can be installed.

In this tutorial you will learn:

  • How to add repository using Flatpak
How to add repository using Flatpak
How to add repository using Flatpak
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
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

Add repository using Flatpak step by step instructions




Follow along with the steps below to add a new Flatpak repo (remote) on your Linux system, and then use that remote to search for software to install.

  1. Start by opening a command line terminal. The syntax to add a new repository to Flatpak is as follows:
    $ sudo flatpak remote-add --if-not-exists [name] [location]
    
  2. A good example would be the FlatHub repository. This is the biggest repo of software that can be installed with Flatpak, and currently the most popular. To add it to your system, execute the following command:
    $ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    
  3. After the repository has been added, we can search the repo for available software to install. Use the following command syntax to do so. As an example, we will search for GIMP, which is an image editing application.
    $ flatpak search gimp
    
    Searching for an application in Flatpak
    Searching for an application in Flatpak
  4. In case you have more than one repository that offers the software you are searching for, you can see in the screenshot above which remote you are looking at. When selecting the software you want to install, you will need to specify which remote you want Flatpak to download from:
    $ sudo flatpak install flathub org.gimp.GIMP
    

    Notice we explicitly specify the FlatHub repo in the command above, as to avoid downloading the software from any other repo that may also offer it.

Closing Thoughts




In this tutorial, we saw how to add a Flatpak repository (or remote) on a Linux system. Adding new repositories is a necessary step, as Flatpak relies on these software catalogs to search for and download software to install on your system. There are many different software repositories that you can find online, some of which boast many applications to install, or some from individual developers that offer a way to download and maintain their software.



Comments and Discussions
Linux Forum