Flatpak

Jump to: navigation, search
Flatpak

Flatpak.jpg

OSTree based application bundles management


License: LGPL-2.1
Web: https://flatpak.org/


Overview

Flatpak is a free and open source package management system for building and distributing desktop applications on Linux independently from the host system in a sandboxed environment, which help to solve issues related to dependencies and make sure that users across different distros share the same experience.

Installation

Install flatpak package

$ sudo zypper in flatpak

Setup

User Level Setup (Recommended)

Add a user specific Flathub repository:

$ flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
$ flatpak update

Automatically update flatpaks with Discover or Gnome Software

Solutions like Discover and Gnome Software can update automatically the flatpak applications, but if you don't use applications as such a valid option is to create a systemd unit and timer to handle this automatically for you.

Manual setup of the systemd unit and timer for automatic setup

To automatically update flatpaks, create the systemd unit service with the $USER that will be using flatpak:

$ systemctl --user edit --full --force update-user-flatpaks.service

Add the following content:

[Unit]
Description=Update user Flatpaks

[Service]
Type=oneshot
ExecStart=/usr/bin/flatpak --user update -y

[Install]
WantedBy=default.target

Then create the timer:

$ systemctl --user edit --full --force update-user-flatpaks.timer

Add the following content:

[Unit]
Description=Update user Flatpaks daily

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

To enable the service reload the systemd units and enable the timer:

$ systemctl --user daemon-reload
$ systemctl --user enable --now update-user-flatpaks.timer

System Level Setup

Add Repository

Add a system-wide Flathub repository:

$ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
$ flatpak update

Automatically update flatpaks with Discover or Gnome Software

Solutions like Discover and Gnome Software can update automatically the flatpak applications, but if you don't use applications as such a valid option is to create a systemd unit and timer to handle this automatically for you.

Manual setup of the systemd unit and timer for automatic setup

To automatically update flatpaks, create the systemd unit service sudo for a whole system setup:

$ sudo systemctl edit --full --force update-system-flatpaks.service

Add the following content:

[Unit]
Description=Update system Flatpaks

[Service]
Type=oneshot
ExecStart=/usr/bin/flatpak --system update -y

[Install]
WantedBy=default.target

Then create a timer:

$ sudo systemctl edit --full --force update-system-flatpaks.timer

Add the following content:

[Unit]
Description=Update system Flatpaks daily

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

To enable the service reload the systemd units and enable the timer:

$ sudo systemctl daemon-reload
$ sudo systemctl enable --now update-system-flatpaks.timer

Usage

Delete a repository

flatpak remote-delete <repo>

List repositories

To list all the added repositories use this command:

flatpak remotes

Installing a new app

To install a new flatpak app use the following

flatpak install <name>

or by specifing the repository

flatpak install <repo> <name>

or user-specific

flatpak install --user <repo> <name>

Uninstalling an app

flatpak uninstall <name>

Find an app

Once you've configured a repository

flatpak search <name>

Updating a specific app

flatpak update <name>

List installed apps

flatpak list

See also

Related articles

External links