Setting Up a Flatpak Remote Repository to Make Installing Apps Easier

Flatpak provides developers and administrators with a lot of flexibility in how they decide to distribute applications. Flatpak can query online repositories (or “remotes”) for software to download and for new updates to already installed applications. Developers can choose to host their own repo and share it with users that wish to download their software, or submit their work to a well known online repo like FlatHub.

Similarly, system administrators can create collections of software they wish to distribute to a network of computers, and create their own Flatpak repo to facilitate with the distribution and installation of that software, as well as using it to maintain updates. In this tutorial, we will take you through the step by step instructions to set up your own Flatpak remote repository to make installing apps easier on a Linux system.

In this tutorial you will learn:

  • How to create a new Flatpak repository
  • How to add apps to a Flatpak repository
  • How to install an app from your Flatpak repo
Setting Up a Flatpak Remote Repository to Make Installing Apps Easier
Setting Up a Flatpak Remote Repository to Make Installing Apps Easier
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

Setting Up a Flatpak Remote Repository to Make Installing Apps Easier step by step instructions



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


The flatpak-builder command is what developers use to package their Flatpak applications. This same tool can also, optionally, be used to export the application to a repository. Afterwards, developers or administrators can host the exported data on a web server, where users will be able to add the repository and download the hosted software.

The steps below assume that you have already created your own Flatpak app or have some apps already downloaded which you wish to share out via a remote repository that you are prepared to host either locally or publicly.

  1. First, we will run our ordinary flatpak-builder command which is required in order to package our application in Flatpak. However, we will append the --repo option which tells the command to export the data to a repo. Specify your repo name in the command below, which can simply be the path to some directory. If it does not already exist, it will be created for you.
    $ flatpak-builder --gpg-sign=[key] --repo=/path/to/repo [build directory] [manifest file]
    

    It is recommended to sign your export with a GPG key. If you do not want to provide one, you can simply omit the option and use --no-gpg-verify instead:

    $ flatpak-builder --no-gpg-verify --repo=/path/to/repo [build directory] [manifest file]
    
  2. If you have more than one application, you can execute the flatpak-builder command once again and provide the same repo as before, but with a different build directory and manifest file. The command will add the application to the same repo. Afterwards, this directory can be hosted online or a local intranet.
  3. Next, we can add the new repository to Flatpak, and then install our application(s) from the repository. Here we are simply calling our repository “myrepo.”
    $ flatpak --user remote-add --if-not-exists --no-gpg-verify myrepo [URL to repo]
    $ flatpak --user install myrepo [app id]
    

    Note that we use the --user option here to avoid installing the application for system wide use. You may omit this option if you wish.

  4. Finally, we can run our new application that was just installed from the repository:
    $ flatpak run [app id]
    

Closing Thoughts




In this tutorial, we saw how to create a Flatpak repository and add applications to it on a Linux system. This allows developers to package and distribute their software through the Flatpak package manager, and ultimately decide whether they wish to host their own software repository or submit their work to an online Flatpak remote. It also allows administrators to host their own curated catalog of software and manage it through Flatpak.



Comments and Discussions
Linux Forum