Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

https://ostechnix.com/how-to-install-and-use-flatpak-in-linux/

How To Install And Use Flatpak In Linux


July 1, 2021 12966 Views 4 comments 13

In this tutorial, we will see what is Flatpak, how to install Flatpak on Linux and then how to use Flatpak command line user interface to install applications.

Contents

...

  1. A Beginners Guide To Flatpak
    1. 1. Add remote repositories
    2. 2. List remotes
    3. 3. Install Flatpak applications
    4. 4. Run Flatpak applications
    5. 5. Search for flatpak applications
    6. 6. List locally installed flatpak applications and runtimes
    7. 7. List remote applications and runtimes
    8. 8. Update flatpak applications
    9. 9. View details of a flatpak application
    10. 10. Uninstall flatpak applications
    11. 11. Remove remote repositories
    12. 12. Remove unused runtimes
    13. 13. Remove flatpak cache
    14. 14. Repair flatpak installation
    15. 15. View flatpak history
    16. 16. Display flatpak help section
  2. Conclusion


Introduction to Flatpak

There are so many Linux distributions and packaging applications for all of those Linux distributions is quite time consuming and difficult task. Even though there are many package converters exists, they all have limited functionality and compatibility issues.

To overcome this problem, an application package format named Snap has been introduced by Canonical. Snaps are initially developed for Ubuntu operating system, but it is now adopted by major Linux distributions including Arch, Gentoo, Fedora, openSUSE etc.

...

Flatpak is originally developed by Alex Larsson and later endorsed by Red Hat, Endless Computers and Collabora. It is now actively maintained by an independent community, made up of contributors, volunteers and supporting organizations. The Flatpak framework is written in C and released under LGPL license.

Runtimes

Each flatpak application depend on a runtime in order to work properly on a host system. A runtime is nothing but a set of basic dependencies (libraries) required by an application.

...

There are currently three main runtimes available: Freedesktop, GNOME and KDE. These are all hosted on Flathub repository.

Bundled libraries

The libraries that are not available in a runtime are bundled along with the application by the developers. The libraries can also be the different versions of libraries from the ones that are in a runtime and/or patched versions of libraries.

Sandboxes

A Flaptpak app is built and run in an isolated environment known as "Sandbox". In other words, the flatpak apps are isolated from the rest of the host operating system, and other applications.

Each sandbox contains the application and its runtime. A flatpak application can only access the contents of its sandbox by default. Access to the user files, network, graphics and the devices have to be explicitly given by the user.

Repositories

All flatpak applications and their runtimes are stored in a central place called "Repositories". Flathub is the official repository of all Flatpak applications. We can access and install the applications and runtimes using flatpak command line interface.

Install Flatpak On Linux

Flatpak is available in the default repositories of popular Linux distributions such as Arch Linux, Debian, Fedora, Gentoo, Red Hat, Linux Mint, openSUSE, Solus, Mageia and Ubuntu distributions.

...

For other Linux distributions, refer the official installation link.

A Beginners Guide To Flatpak

There are many popular applications such as Gimp, Kdenlive, Steam, Spotify, and Visual studio code etc., available as flatpaks. To install a flatpak app, we need to first add flatpak repositories (or remotes).

1. Add remote repositories

As I mentioned already, the applications and runtimes are stored in a repository or remote. The official repository for flatpak is Flathub.

...

There are many other unofficial flatpak repositories are available. Do a quick web search to find them.

2. List remotes

To list all configured remote repositories, run:

...

As you can see, the above command lists the remotes that you have added in your system. It also lists whether the remote has been added per-user or system-wide. In my case, I have added flathub repository system-wide.

3. Install Flatpak applications

In this section, we will see how to install flatpak apps.

...

$ ls $HOME/.var/app/
com.github.calo001.fondo com.github.tchx84.Flatseal org.gnome.Boxes

4. Run Flatpak applications

You can launch the installed applications at any time from the application launcher. From command line, you can run it, for example GNOME boxes, using command:

...

Flatpak will add the menu entries for all flatpak apps. So you can directly launch the from the menu or application launcher.

5. Search for flatpak applications

To search for a application:

...

This command will return all applications that matches to the string "gimp" from all remotes.

6. List locally installed flatpak applications and runtimes

To view all installed flatpak applications and runtimes on your system, run:

...

Name             Application ID                  Version      Branch      Installation
Fondo            com.github.calo001.fondo        1.3.8        stable      system
Flatseal         com.github.tchx84.Flatseal      1.5.2        stable      system
GNOME Boxes      org.gnome.Boxes                 3.36.6       stable      system

7. List remote applications and runtimes

You can also view the list of available applications and runtimes from the remote repositories as well.

...

$ flatpak remote-ls flathub --app

8. Update flatpak applications

To update all your flatpak applications, run:

...

$ flatpak update org.gnome.Boxes

9. View details of a flatpak application

To display the details of a installed application, run:

...

GNOME Boxes - Simple remote and virtual machines

          ID: org.gnome.Boxes
         Ref: app/org.gnome.Boxes/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 3.36.6
     License: LGPL-2.1+
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 706.9 MB
     Runtime: org.gnome.Platform/x86_64/3.36
         Sdk: org.gnome.Sdk/x86_64/3.36

      Commit: 98c619ed78736e85433bcbecd5c4392ad30d4890a71ddc909f5b4c51dfcde340
      Parent: 72ec972e0ce7fdf640f478d406a8acad5f90ebd1f8c0ac330baa7ed3dd5ccd70
     Subject: Build vte from git master (a8cf05d9)
        Date: 2020-09-02 10:02:20 +0000

10. Uninstall flatpak applications

To remove a flatpak application, run:

$ sudo flatpak uninstall org.gnome.Boxes

11. Remove remote repositories

To remove a remote, for example flathub:

...

Here, flathub is the name of the remote.

12. Remove unused runtimes

After you removed all applications that depend on a specific runtime, the runtime itself will not be removed automatically.

...

$ flatpak uninstall --unused

13. Remove flatpak cache

To remove leftover flatpak cache in the tmp location, run:

...

From now on, the leftover flatpak cache files will be cleared at startup.

14. Repair flatpak installation

We can repair a flatpak installation by pruning and reinstalling invalid objects.

...

$ flatpak repair --system

15. View flatpak history

You might have installed some apps, updated them or removed them. All the flatpak transactions will be logged by flatpak.

You can look at these logs to find out what changes have been made to your Flatpak installation over time.

$ flatpak history

16. Display flatpak help section

For flatpak help, run:

$ flatpak --help

This command will display the list of all available flatpak options and sub-commands with a little description.

Conclusion

This flatpak tutorial gave you a brief introduction to Flatpak, and the underlying technologies used in Flatpak such as runtimes, remotes, bundled libraries, and sandboxes etc. And then, It also explained how to install and use flatpak on Linux distributions.

...