Ubuntu lets you install Snap apps and regular repo software out of the box. No set-up required. But if you want to install Flatpak apps on Ubuntu you need to install a couple of things yourself.
An omg! reader asked if I could put together a step-by-step guide to show them how to install Flatpak on Ubuntu 18.04 LTS and 20.04, as well as how to set up the Flathub repo, and how to install Flatpak apps from Flathub on Ubuntu — so I figured I would!
The good news is that the whole process is pretty easy.
Why Use 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 Snap apps in many ways: apps are sandboxed; come bundled up with everything they need to run; and support automatic background updates.
As these new app package technologies let Linux users install apps regardless of which distro or package manager they use, more developers are choosing to distribute their software using using them.
Thanks to 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.
‘Build once and run everywhere is a strong sell’. Dependencies are the main headache when packaging software for different Linux distributions. Flatpak (like Snaps and AppImages) ‘solves’ this.
Flatpak apps ask for permission before they can access some hardware (e.g., webcam); read or open files outside of their sandbox; use location detection technologies like geoclue, and more. You can manage these permissions (i.e. revoke them) at any point using Ubuntu’s Settings app.
In all, Flatpaks gives you far greater control over the software you run, and developers.
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
The fastest way to install Flatpak on Ubuntu (either 18.04 LTS or 20.04 LTS and above) is to use the command line.
— Oh, don’t look at me like that!
Running terminal commands is scary, I get that. But there’s little to go wrong provided that you follow the instructions as written. Plus, because of the way the Ubuntu Software app is now packaged trying to do the same task using a GUI is …laborious.
So, to install Flatpak on Ubuntu (and a few other things you’ll need later) pop open a new Terminal window and run the following command:
sudo apt install flatpak gnome-software-plugin-flatpak gnome-software
Enter key and type in your password if/when prompted.
You’ll be asked to confirm the install. You’ll notice a couple of extra packages are listed at this point. These are dependencies that are required, so you can’t skip them.
Y to allow the installation to proceed.
Once complete, you have Flatpak installed on Ubuntu.
How to Add the Flathub Remote
To actually install Flatpak apps you need to connect the tool to a repository (called a ‘remote’ in Flatpak speak).
Flathub is the primarily 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 use and any app developer can add their apps to.
To add Flathub to Ubuntu and connect it to Flatpak run the following command:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
You may be asked to enter your password to authorise the change.
A blink or two later and there’s only one thing left to do: restart your computer. This helps ensure that all the components lock into place correctly, and things work as expected.
You now have everything you need to install Flatpak apps on Ubuntu using the GNOME Software app, the command line, and/or the Flathub website.
How to Install Apps from Flathub
On Ubuntu 18.04 LTS you can search for and install Flatpak apps from the Ubuntu Software client, but on Ubuntu 20.04 LTS and above you’ll need to use the Software app.
To distinguish between them just look at the icon: if it’s a white shopping bag, it’s Software, if it’s orange it’s Ubuntu Software.
When you search for and browse apps in the Software app (whichever you use) you may find it difficult to tell which ones are Flatpaks, which apps are Snaps, and which are regular repo software. In 18.04 LTS keep an eye out for the “source: flathub.org” text in Software search results:
On Ubuntu 20.04 LTS and above you’ll only be able to tell if an app is a Flatpak when opening the listing page and seeing a ‘source’ menu in the header bar (first image) or, if not present, scrolling down to the meta-data section to see if Flathub is mentioned there (second image):
You can also browse and install apps from Flathub using your web browser. Just point your browser towards the Flathub website to get started. From here you can search for and find Flathub based on 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) then click OK (3):
This will open Software app.
Click the install button to — well, I’m sure you can guess!
That’s all there is to it.
Now you know how to install and use Flatpak apps and Flathub on Ubuntu.
You can remove Flatpak apps using the Software tool (provided you install the Flatpak plugin), as well as check for updates to Flatpak apps and install those updates.
If you prefer to do this from the command line simply run
flatpak refresh to check for updates and
flatpak update to install the updates.