Get up to date with Flatpaks
that’s installed elsewhere on the system.
The user install is possible because of how the sandbox is constructed. Think of it this way: as a user, you have the ability to run an application. That application has the rights (through your user account) to create an on-screen window, write files to disk, and access network connections. When you install a Flatpak as a user, any resources from the host system are limited by what you yourself could access with a normal” program.
The first component you need to install Flatpaks (the package format) is Flatpak (the application). Most distros provide it in their repositories. In Ubuntu, you can issue the following to get up and running: $ sudo apt install flatpak
This will, of course, give you the version that’spackagedwiththecurrentversionof your distro. If you’re on along-term support version,suchasUbuntu’s16.04(Xenial),this may mean you won’t get newer features. Installing from the official Flatpak PPA is the recommendedwaytomakesureyoualways have the most recent version: $ sudo add-apt-repository ppa:alexlarsson/flatpak $ sudo apt update $ sudo apt install flatpak
Once it’s installed, you’ll be able to install Flatpak programs using the command line. But some GUI package managers also have support for the format. KDE’s Discover, for example, can manage your Flatpak files if you install the appropriate backend.
With the right tools installed, there’s one quick step to take before you can start hunting for some new apps.
Flatpak seems to have adopted the term hubs to describe collections of software, just like RPM or DEB repositories. The Flatpak site itself hosts the first one you should add, FlatHub. Register it with your system using your package manager, or at the terminal with the following command: $ flatpak remote-add --if-notexists FlatHub https:// flathub.org/repo/flathub. flatpakrepo
You can see a list of your configured hubs by running $ flatpak remotes
ON THE MENU
There are a couple of different application types that lend themselves to being packaged as Flatpaks. The first of these is commercial applications. If the developers of commercial products don’t make it easy for the community to pick their applications apart, it’s solely up to them to package everything.
Flatpakgivesasingletargetforpackages that will work acrossdistros,and sandboxing the apps can help reduce support costs. Someexamplesofcommercial(though free) programsinFlathubincludeSteam,Slack, and Sublime Text.
Anothertypeof application that makesa goodFlatpakislarge,complexapplications. These benefit from Flatpak’s atomic upgrades, making the update process alittle less painful, and the roll-back process even less so. LibreOffice, which is normally a 200MB update, and AndroidStudio, which is even more, are both available as somewhat more convenient Flatpaks.
Finally,cross-platformappsalreadyhave two completely different OS targets (at least for desktop, even more if they’re mobile). Developers and packagers surely don’t need to worry about the idiosyncrasies of adozen Linux distros on top of that. Just wrap your app up as a Flatpak, and you’re good to go.
INSTALLING FLATPAK PROGRAMS
Installing applications from the Flatpak will feel very familiar if you’re accustomed to using apt or either yum or dnf on your system. The search command will show you hits in any of
your configured for the keyword that you provide: $ flatpak search calibre
This will return a result for the excellent Calibre e-book manager, which is often out of date in the Ubuntu repositories. Note the first column, which gives the Application ID in a sort of reverse-domain format (com first, then domain, and so on.). You’ll need to give this to the install command for Flatpak to install your program: $ flatpak install com. calibre_ ebook.calibre
At this point Flatpak will start downloading and installing your application and any runtimes (org. freedesktop – see the screenshot, below right) it requires. A runtime is a collection of libraries and other software for the application. It’s the Flatpak way of resolving your dependencies for you.
“Wait,” you might say, “isn’t this what apt and yum do for me?” It’s a fair question. There are a few notable factors that set runtimes apart from normal Linux dependency management. Flatpak’s sandbox environment ≠≠ ensures anything you install won’t conflict with your system proper. A runtime is a fixed set of software, ≠≠ so you know you’ll get exactly you need to run the app – no more, no less. Flatpaks are built against specific ≠≠ runtimes, so there’s no need to worry about upgrades breaking your program all of a sudden. The trade-off boils down to confidence that the program will always have what it needstorunasintended,butnotethatit’ll need to take up more disk space to do so.
There are a couple of other methods you can use to install applications. If you happen across a rogue Flatpak and download it, install it from the command line using the command above: $ flatpak install somefile. flatpak
Finally,Flatpakprovidesamethodfor installing an application by running an installation file. This file, called a
flatpakref, contains some metadata about the program, including: Its full name. ≠≠ The hub from which it should be ≠≠ downloaded. Its version ≠≠ Whether it is a runtime or not. ≠≠ Its GPG signature. ≠≠ Installing from a flatpakref file is the same as installing from a locally downloaded Flatpak file: $ flatpak install ./ somereffile.flatpakref
You can also use a GUI package manager, which should display and install Flatpaks in the same way it does other packages (provided that you installed the backend). Once your program is installed, you can launch it from the command line as follows: $ flatpak run com.calibre_ ebook.calibre
Once the program starts up, there are a couple of things you’ll notice. The first is that you’ll have access to all your normal $HOME directory files. “But, but,” you’ll ask, “I thought the Flatpaksandbox was isolated from the rest of the system?” That’s very astute of you. However, runningaprogramthatcan’tinteractwith your files isn’t very useful. The Flatpak developers have worked around this.
You should also see entries for the application show up in your desktop’s menu. Under most circumstances, you shouldn’t be able to tell the difference between these programs and those provided by your distribution. You can operate on your files, play multimedia files, and generally use them as a “normal” program.
MANAGING YOUR FLATPAK INSTALLS
Once you have a Flatpak or two installed, you can, of course, use your GUI package manager to administer them. But if you prefer the terminal, some of the below commands will be useful. You can list the Flatpaks (both apps and runtimes) you have installed with the following command: $ flatpak list
Theresultdisplaysnotonlytheinstalled modules, but also their installation type ( system/user). You can update all your Flatpaks with asingle command, just like native package managers: $ flatpak update
In the event you need to remove a Flatpak, enter the following at the prompt: $ flatpak remove [fullqualified app name]
If you need to remove one of the hubs you’ve configured, you can do so with the following: $ flatpak remove-remote [name of remote]
The benefits of the Flatpak format are numerous. It provides developers with an option to target multiple distributions, while giving users multiple tools to install the resulting applications. It enables programs to access the resources they need, while restricting them from the things they don’t. It works around some of the dependency problems of traditional packaging formats, at the expense of a little disk space. Finally, it opens up opportunities for developers to wrap up applications that are traditionally tedious to install in a format that’s drop-dead simple.
So if you want to try out the cutting-edge version of LibreOffice or run a Wine-based game like World of Warcraft, give Flatpak a try. You really can’t go wrong!
Two different versions of LibreOffice running at the same time, on the same machine. Is it magic? No, just Flatpak.
The results of the flatpak search command give you the three-part, reverse- domain ID that you’ll need to install.
Like traditional package managers, Flatpak will download and install Calibre and the runtimes on which it depends.