The last time Hackerfall tried to access this page, it returned a not found error. A cached version of the page is below, or click here to continue anyway


Create an App with Flatpak

Developers can quickly get started using the tutorial below. More detailed information is available in the developers page.

1. Install Flatpak

First we need to install Flatpak itself. The instructions here are for Fedora or Ubuntu. Details for other distros can be found on the getting Flatpak page. If you are using Fedora, run:

$ sudo dnf install flatpak

On Ubuntu, Flatpak is available through a PPA. To install it, run:

$ sudo add-apt-repository ppa:alexlarsson/flatpak
$ sudo apt-get update
$ sudo apt-get install flatpak

2. Install a runtime

Flatpak requires every app to specify a runtime that it uses for its dependencies. We'll use the GNOME 3.20 development platform runtime for this. To install the runtime, we first need to add the repository that provides it. Run:

$ wget
$ flatpak remote-add --user --gpg-import=gnome-sdk.gpg gnome

And then install the runtime itself:

$ flatpak --user install gnome org.gnome.Platform 3.20

3. Create your app

First we need to create the directory structure for the app:

mkdir hello
mkdir hello/files
mkdir hello/files/bin
mkdir hello/export

Now let's add something simple: create a file in hello/files/bin/ called Then add the following to the file and save it:

echo "Hello world, from a sandbox"

Now we need to provide some information about the application. In Flatpak this is specified in a key-value file called "metadata", which goes in the hellodirectory. For a simple app this doesn't contain much, so we can create it manually:


This specifies the application identifier (org.test.Hello) as well as the runtime the application uses and the command to start the app with.

4. Put the app in a repository

Congratulations, you've made an app! To be able to install it, you need to put it in a repository. This is done with the build-export command:

  flatpak build-export repo hello

This will initialize a local repository in the "repo" directory and export the app to it.

5. Install

Now we're ready to add the repository that was just created and install the app. This is done with two commands:

flatpak --user remote-add --no-gpg-verify tutorial-repo repo
flatpak --user install tutorial-repo org.test.Hello

6. Run

All that's left is to run the app. This can be done with:

flatpak run org.test.Hello

This will print Hello world, from a sandbox.

Ta da! That's it: you've successfully built, installed and run your first Flatpak. Many of these steps are simplified by Flatpak's built in tools. For information on how to use them, as well as how to build and distribute more complex apps see the developers page.

Continue reading on