Flatpak

Jump to: navigation, search
Flatpak

Flatpak.jpg

OSTree based application bundles management

Download for openSUSE


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

user $ sudo zypper install flatpak

Setup

User Level Setup (Recommended)

Add a user specific Flathub repository:

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

Automatically update flatpaks with KDE Discover or Gnome Software

Solutions like KDE Discover and Gnome Software can update automatically 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.

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

Add the following content:

[Unit]
Description=Flatpak Automatic Update
Documentation=man:flatpak(1)
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/bin/flatpak --user uninstall --unused -y --noninteractive ; /usr/bin/flatpak --user update -y --noninteractive ; /usr/bin/flatpak --user repair

Then create the timer:

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

Add the following content:

[Unit]
Description=Flatpak Automatic Update Trigger
Documentation=man:flatpak(1)

[Timer]
RandomizedDelaySec=10m
OnBootSec=2m
OnCalendar=*-*-* 4:00:00
Persistent=true

[Install]
WantedBy=timers.target

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

user $ systemctl --user daemon-reload

and then

user $ systemctl --user enable --now flatpak-user-update.timer

System Level Setup

Add Repository

Add a system-wide Flathub repository:

user $ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
user $ 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:

user $ sudo systemctl edit --full --force flatpak-system-update.service

Add the following content:

[Unit]
Description=Flatpak Automatic Update
Documentation=man:flatpak(1)
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/bin/flatpak --system uninstall --unused -y --noninteractive ; /usr/bin/flatpak --system update -y --noninteractive ; /usr/bin/flatpak --system repair

Then create a timer:

user $ sudo systemctl edit --full --force flatpak-system-update.timer

Add the following content:

[Unit]
Description=Flatpak Automatic Update Trigger
Documentation=man:flatpak(1)

[Timer]
RandomizedDelaySec=10m
OnBootSec=2m
OnCalendar=*-*-* 4:00:00
Persistent=true

[Install]
WantedBy=timers.target

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

user $ sudo systemctl daemon-reload && sudo systemctl enable --now flatpak-system-update.timer

Usage

Delete a repository

user $ 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