Ordinarily, Flatpak is utilized by querying online repositories for software to download and install. Installing an application from a repository (like FlatHub) means that it is very easy to maintain updates for the application and others that have been installed via Flatpak. However, Flatpak also gives us the option to install individual applications with the
This can be useful in situations where a developer has created some software that can be installed with Flatpak, but has not yet uploaded the application to a central repository for distribution and organized updates. These individual installations are distributed in what is called single-file bundles.
In this tutorial, you will learn how to get started with Flatpak app bundles by seeing how to create an app bundle and install it with Flatpak on a Linux system.
In this tutorial you will learn:
- How to create a single app bundle in Flatpak
- How to install and run a single app bundle
|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
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
An Introduction to Flatpak App Bundles
Flatpak single-file bundles do not provide the user with an easy way to keep their software up to date, which is the main reason that the preferred method is to upload your work to a Flatpak remote. Furthermore, dependencies can not be automatically identified and downloaded when installing single file bundles.
- First we will need to download and install a runtime and SDK, as every Flatpak app requires a runtime, and the SDK is required in order to build and package the app. Install the Freedesktop 22.08 runtime with the following command:
$ flatpak install flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08
- Create your app. If you do not already have an application that you wish to package, and just want to run this as a test, create a simple Hello World script:
#!/bin/bash echo "Hello World!"
Save your file as
- You will also need a manifest file alongside your application. Again, just for testing purposes, we can create a simple Hello World manifest file:
app-id: org.flatpak.Hello runtime: org.freedesktop.Platform runtime-version: '22.08' sdk: org.freedesktop.Sdk command: hello.sh modules: - name: hello buildsystem: simple build-commands: - install -D hello.sh /app/bin/hello.sh sources: - type: file path: hello.sh
Save this file as
org.flatpak.Hello.ymland store it in the same directory as your application or
hello.shfile created above.
- Next, use the
flatpak-buildercommand to create the application.
$ flatpak-builder build-dir org.flatpak.Hello.yml
- To install the single app bundle as an individual application, we will use the following command:
$ flatpak-builder --user --install --force-clean build-dir org.flatpak.Hello.yml
- Then we can run our application with:
$ flatpak run org.flatpak.Hello
In this tutorial, we saw how to create and install a single app bundle in Flatpak on a Linux system. Although Flatpak normally operates by downloading installing software from a repository, it also gives us the option to install and distribute individual application files without the need to host or upload them to a software repository.