Ubuntu has support for Snap apps and regular repo software out of the box. But Snaps aren’t the only universal package format on the scene. Flatpak is a fast-growing alternative. Many of the cool new Linux apps we write about on this blog are only available through Flathub.
An omg! reader asked if I could put together a step-by-step guide on how to install Flatpak on Ubuntu, how to set up the Flathub repo, and how to install Flatpak apps from it.
So this is that post!
The Benefits of Flatpak
Flatpak is a ‘next-generation’ Linux app format developed by Red Hat and used in Fedora, among other many other Linux distros.
It’s similar to Snappy in many ways: apps are sandboxed; come bundled up with everything they need to run; and support automatic background updates.
Because these new app package technologies allow Linux users to install apps regardless of which distro or package manager they use, more and more software developers are choosing to distribute apps using using them.
Build once, run everywhere is a strong sell. Dependencies were the main headache in packaging software for different Linux distributions, something Flatpak (like Snaps) ‘solves’.
And by using OSTree Flatpak enables developers to create a complete app bundle that contains all of the dependencies, libraries and other files needed to run their program.
As Flatpak apps are run in isolation from the rest of the system it’s possible to install multiple versions of the same program at the same time (e.g., nightly and stable) together.
Flatpak apps also have to ask for permission before they can access hardware (e.g., web cam); read or open files outside of the sandbox; or use location detection technologies like geoclue. In all, Flatpaks gives you far greater control over the software you run.
So why use Flatpak? There are a few key reasons:
- No dependency incompatibilities
- More control over what apps can do
- Get app updates sooner
- Access a wider range of software
- Get updates direct from app developers
There are plenty of other reasons why you might want to use this new-fangled app format, so feel free to expand on this in the comments section.
How to Install Flatpak on Ubuntu 18.04 LTS+
If you run Ubuntu 18.04 LTS or later you can install Flatpak on Ubuntu straight from the Ubuntu Software tool, but you can’t search for it by name.
Instead, hit this button to open the install page:
A small prompt will appear asking you to OK the installation:
Click ‘Install’ and let it do its thing!
Use the Flatpak PPA for Newer Versions
New versions of Flatpak are released often but those updates are not usually pushed out to Ubuntu users.
If you want to install the latest version of Flatpak on Ubuntu (and chances are you do) then add the following official Flatpak PPA to your software sources. The PPA supports Ubuntu 16.04 LTS and above:
sudo add-apt-repository ppa:alexlarsson/flatpak
sudo apt update && sudo apt install flatpak
But you’re not done yet…
How to Add Flathub on Ubuntu
Flathub is the go-to app store for Flatpak apps. More and more developers are choosing Flatpak and Flathub as their primary distribution method. Like the Snap store, Flathub acts as a centralised repository that any user can install Flatpak apps from, and any app developer can add their apps to.
Adding the Flathub Repo
To install Flathub on Ubuntu run this command:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
You will be asked to enter your password to authorise the change.
And then… That’s almost it! All you need to do now is restart your computer so that all the necessary components lock into place correctly.
When your system comes back up you’ll be set; you have everything you need to install Flatpak apps on Ubuntu using the command line or the Flathub website.
How to Install Apps from Flathub
If you install the Flatpak software plugin on Ubuntu 18.04 LTS you can search, browse, and install Flatpak apps on Ubuntu from the Ubuntu Software client..
The downside is you may find it difficult to tell which apps are Flatpaks, and which apps are Snaps or regular repo software. Keep an eye out for the “source: flathub.org” text in Software search results:
You can also browse and install apps from Flathub using a web browser. Just point your browser towards the Flathub website to get started.
Here you can browse apps on Flathub based on their category (Utility, Games, etc) or search for apps by name (e.g., ‘GIMP’, ‘Spotify’, etc).
When you find an app you want to install all you have to do is click through to its store listing page and click the “Install” button (1).
You’ll see a dialog asking you which app you want to open the .flatpakref file with. Make sure that “Software install (default)” is selected (2):
This will start installation of the Software:
Ubuntu Software will open up and you’ll be able to see the pgoress of installation.
That’s all there is to it. Now you know how to install and use Flatpak apps and Flathub on Ubuntu. Hope you found this helpful!