From Mageia wiki
Jump to: navigation, search


Drakconf multiflag.png
Other languages
Deutsch ; English ; Español; Français ; Nederlands ; Português (Brasil) ;
Synopsis:
Flatpak is one way to get access to many more applications than are packaged by Mageia - even though we have quite a few already. For even more ways, see Ways to install programs.


What is Flatpak

Flatpak is an utility for software deployment and package management for Linux. It is advertised as offering a sandbox environment in which users can run application software in configurable isolation from the rest of the system. Flatpak was developed as part of the freedesktop.org project (formerly known as X Desktop Group or XDG) and was originally called xdg-app.

Using Flatpak, you can install a vast range of applications more directly from developers, and independent from the rpm package system.

The Flatpak system maintains internal dependencies for applications, installing what extra is needed automatically.

Programs are run sandboxed, except for rights asked at install time.

In Mageia, we support this technology by having flatpak and it's dependencies packaged.


32-bit availability

While we have the system packaged, it is very hard to find 32 bit flatpak applications.

Both i386 and armv7 have been discontinued on Flathub.

If you have the application files you can install them manually, consult Flatpak documentation.


Install the Flatpak system

Flatpak is installed by default for most common Mageia install choices

If not, you can install it using the Mageia Control Center (MCC), or in a console with sudo

  • and urpmi
$ /usr/bin/sudo urpmi flatpak
[sudo] password for user:
  • or DNF:
$ /usr/bin/sudo dnf install flatpak
[sudo] password for user:


However, if you do not have sudo set up and do not want to use MCC, you first need to become root:

$ su -
password (for root):

and then type urpmi flatpak or dnf install flatpak and hit the "enter" key.


System wide or user only

You can configure Flatpak repositories and install applications system wide (for all users) or per user. By default Flatpak install repos and applications system-wide. To install for current user, add "--user" as flag to the Flatpak remote-add and install commands etc respectively.

One aspect of choosing which, is where you have enough space, if the application is big. User installs get stored in ~/.local/share/flatpak/, and system wide apps and base content are stored in /var/lib/flatpak/.

If you have repos for both system and user configured, Flatpak ask for each application if you want to install it system wide or only for your user.


Add Flatpak repositories

(Also called remotes) You must add a Flatpakrepo - a repository of Flatpak apps. The two below are most common and contains a lot of applications.

Adding a repo like in examples will make it system wide, and will ask for root provilegies if you are not root.

If you prefer to install per user (i.e if low on space in / but not in /home), remember to add "--user" to remote-add and install commands as described above.


  • flatpak repository from Flathub (flathub.org) which contains free and nonfree softwares:
$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  • flatpak repository from Fedora (fedora.org) which contains free-only/open-source softwares:
$ flatpak remote-add --if-not-exists fedora oci+https://registry.fedoraproject.org

Examples for some specific programs


Built-in help

Some help is built in. Try:

$ flatpak --help
And for example:
$ flatpak install --help

But also see available commands and explanations in the Command Reference. Note that many commands are for making Flatpaks, but there are a lot of commands to handle them userside too.


Installing Flatpak applications

To search for an application within installed remotes, you can use part of name:

$ flatpak search chromi

Simply in a console let it find and install the application. You need not type the full name. The application needs to be in a configured repository, or else it will respond it did not find it. If you install for user, you need to have a repository installed for user. (how, and system/user we explained above)

Example:

§ flatpak install warpin Looking for matches? Found similar ref(s) for ?warpinator? in remote ?flathub? (user). Use this remote? [Y/n]: y Found ref ?app/org.x.Warpinator/x86_64/stable? in remote ?flathub? (user). Use this ref? [Y/n]: y org.x.Warpinator permissions: ipc network fallback-x11 wayland x11 dri file access [1] dbus access [2] bus ownership [3] [1] /media, home [2] org.freedesktop.FileManager1, org.x.StatusIconMonitor.* [3] org.x.StatusIcon.warpinator ID Branch Op Remote Download 1. org.x.Warpinator.Locale stable i flathub < 282.3?kB (partial) 2. org.x.Warpinator stable i flathub < 5.5?MB Proceed with these changes to the user installation? [Y/n]:

Note it displays what permissions the applications will be given.

Above, it will install the applications as two packages. Some applications depend on several additional packages, which then also will be listed if not already installed. Accept, and it will install.

How to install using flatpakref

Example: Unofficial Firefox ESR:

$ flatpak install https://gitlab.com/projects261/firefox-esr-flatpak/-/raw/main/firefox-esr.flatpakref


Graphical install tools

Starting with Mageia 8, we recommend to use plasma-discover (Discover)) under Plasma/LXQt or gnome-software (GNOME Software) under a GTK-desktop environment.

Start the chosen tool, and type for example Spotify or Digikam in the search field. Note that it will ask for your password to install one, this is guarded by Parental-Controls (malcontent).

Note that in Plasma Discover, flathub repository can be set in menu Settings -> Add flathub.


Launching Flatpak applications

They may be found in your desktop launch menu as icon or by using a search field there.

If not, you can copy the supplied .desktop file to your desktop or launch menu: For user installed apps you find them in ~/.local/share/flatpak/exports/share/applications/ and for system wide installed apps see /var/lib/flatpak/exports/share/applications/.

Alternatively you can use your desktop environments usual method to create a launch icon or menu item, and enter the launch command line per below. For the icon, some desktop environments dialogues find it, i.e in Plasma's tool you click the icon to open icon chooser dialogue, "System icons" and "Applications" are selected by default and when you type in the search field the icon is found. Else, for user installed programs go down under ~/.local/share/flatpak/exports/share/icons/ etc and for system installation /var/lib/flatpak/exports/share/icons/ etc.

To figure out the launch command line, use the Flatpak list command to see installed programs Application ID:

$ flatpak list
Name Application ID Version Branch Origin Installation Czkawka com.github.qarmin.czkawka 3.1.0 stable flathub user Spotify com.spotify.Client 1.1.55.498.gf9a83c60 stable flathub user

The command to execute is "flatpak run" plus the App ID. Example for Spotify: flatpak run com.spotify.Client


Permissions

Your system, user files, and devices are guarded by that the flatpak applications are running in a sandbox.

The applications are given permissions to access only what they should need.

For example, the default permissions may not involve access to your files, the /home folder. Security wise this is of course a good thing - but sometimes you need applications to work on your files. For details see filesystem rights. Some tidbits here.

Fortunately there is a graphical tool to easily manage permissions: Install Flatseal, which is a flatpak itself, in the common flathub repository.

Starting with Mageia 9, Plasma users can also install flatpak-kcm instead, which is the KDE Plasma Systemsettings module for Flatpak permissions management. You find it in Systemsettings section "Personalization": Applications > item Flatpak Permission Settings.


Updating

The Flatpak host system is updated as any other Mageia package.

To update the Flatpak applications and internal dependencies:

$ flatpak update

- or use one of the Graphical tools

If you only want to update only a specific package you can, i.e

$ flatpak update us.zoom.Zoom

In the graphical tools you can select packages by mouse clicking.


Removing

(example: FirefoxESR)

To remove the application :

$ flatpak remove org.mozilla.FirefoxESR

But if you also want to remove its data, add the --delete-data flag:

$ flatpak remove --delete-data org.mozilla.FirefoxESR

To remove a remote (repository):

$ flatpak remote-delete firefoxesr-origin


Cleaning

To remove unused dependencies:

$ flatpak uninstall --unused

This will remove supportive flatpak functionalities no longer used by removed applications, or i.e elder or no more used (versions of) Nvidia driver, Freedesktop Platform, GNOME Application Platform.


Pros and cons

One of the best things about using Flatpak, is it will give you the possibility to execute latest version of popular graphical programs like Firefox, Evolution,... and they use a shared framework that is being updated upstream. This is also a way to have one program version installed by a Mageia package, and another version as a Flatpak.

One of the down-side of using Flatpak, the first time you install one of them, it will download a lot of dependencies and use quite a lot of space. Example: after installing only KiCAD (which is rather big) as Flatpak system wide, /var/lib/flatpak/ was 4GB.

Warning!
Plasma Discover and GNOME-Software prefer Flatpak over Mageia RPMs! mga#28354.


Further reading

Wikipedia|| flatpak.org || Documentation || Getting started (Fedora) || Command reference