Learn how to install and use the Flatpak package manager on Ubuntu
Installing applications on Linux has never been so easy, thanks to platform-agnostic package managers like Snap and Flatpak. These tools make it possible to build one package that can be installed on different Linux distributions.
Flatpak is a package management and software deployment tool created to facilitate the distribution of desktop applications on Linux. If you have been using Ubuntu for a while now, you certainly have to use or hear about Locked. Flatpak is similar to Snap, in that both are independent package management tools.
So, in this article we will install Flatpak and add the Flathub repo, so we can search and install the Flatpak application on Ubuntu 20.04.
Flatpak officially supports more than 24 Linux distributions, including Ubuntu. Flatpak is available on the Ubuntu 20.04 repo, so to install flatpak run:
sudo apt install flatpak
Then, we can install the flatpak plugin software, which allows to install applications without the command line, through the Gnome Software. To install the flatpak plugin software, run:
sudo apt install gnome-software-plugin-flatpak
After installing flatpak and the plugin software, you can use the flatpak command or Gnome Software to install applications through flatpak. But before we can start installing the application, we need to add a flatpak repository.
Add a Flathub Repository
Because Ubuntu doesn’t have a flatpak repository installed, we had to add an external repository. Flathub is the most popular flatpak application repository. To add a flathub repository, run:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
After adding the flathub repository, you must restart your session so you can search for flatpaks. To do this, log out of your user account and log in again. We are now ready to install the flatpak application on our Ubuntu 20.04 system.
Install the Flatpak Application
You can now install applications from flatpak by using the flatpak command. Use the flatpak search command followed by the application keyword to search for the application.
flatpak search "keyword"
Replace keywords with the application you want to search. Flatpak will not only search for those names, but will also search for suitable keywords in the application description. For example, to search for ‘lollypop’ music players via flatpak, we can run:
flatpak search lollypop
The output of the flatpak search option will include the application name, description, application ID, version, branch and remote.
Next, to install an application using flatpak, use the install flatpak command followed by the name of the application package or application ID. So to install lollypop using flatpak we have to run:
flatpak install lollypop
Flatpak will look for lollypop in the available Flatpak repositories and ask for permission to install the applications and runtime that are needed. Press Y and press enter for a prompt to continue with the installation.
In addition, we want to point out that when installing the flatpak application for the first time, flatpak needs to download the additional runtime that is needed. This can be time consuming because the packages needed can be quite large.
Soon the flatpak application will be installed on your Ubuntu 20.04 system.
In short, we have seen how to install the flatpak package manager, add the flathub repository to flatpak and install applications using the flatpak command on an Ubuntu 20.04 machine.