Installing an application on Linux has never been easier, thanks to platform-agnostic package managers such as Snap and Flatpak. These tools have made it possible to build a single package that can be installed on different Linux distributions.
Flatpak is a package management and software deployment tool created to make distribution of desktop application on Linux easier. If you have been using Ubuntu for a while now, you must have certainly used or heard about Snaps. Flatpak is similar to Snap, in a way both are package management tools that are distribution independent.
So, in this article we are going to install Flatpak and add Flathub repo, so we can search and install Flatpak applications on Ubuntu 20.04.
Flatpak officially supports over 24 Linux distributions, which includes Ubuntu. Flatpak is available in Ubuntu 20.04 repo, so to install flatpak run:
sudo apt install flatpak
Then, we can install software flatpak plugin, which makes it possible to install apps without command line, through the Gnome Software. To install software flatpak plugin, run:
sudo apt install gnome-software-plugin-flatpak
After installing flatpak and software plugin, you can use
flatpak command or Gnome Software to install apps via flatpak. But before we can begin to install applications, we need to add a flatpak repository.
Adding Flathub Repository
As Ubuntu doesn’t have a flatpak repository installed, we’ll have to add an external repository. Flathub is the most popular flatpak application repository. To add flathub repository, simply run:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
After adding the flathub repository, you’ll need to restart your session so you can search for flatpaks. To do so, log out from your user account and log in again. We are now ready to install flatpak applications on our Ubuntu 20.04 system.
Install Flatpak Apps
You can now install apps from flatpak by using
flatpak command. Use the
flatpak search command followed by the application keyword to search for an app.
flatpak search "keyword"
Replace the keyword with the application you want to search. Flatpak will not only search for names it’ll also look for matching keyword in the application description. For example, to search ‘lollypop’ a music player through flatpak, we can run:
flatpak search lollypop
The output of the flatpak
search option will include the name of application, description, application ID, version, branch and remotes.
Next, to install the application using the flatpak, use the
flatpak install command followed by the application package name or application ID. So to install lollypop using flatpak we have to run:
flatpak install lollypop
Flatpak will look for lollypop in available flatpak repositories and ask for permission to install the application and its required runtime. Press
y and hit enter for the prompts to continue with the installation.
Additionally, we would like to point out that when installing flatpak application for the first time, flatpak will need to download additional required runtime. This can take some time as the required packages can be quite large.
Soon the flatpak application will be installed on your Ubuntu 20.04 system.
To sum up, we have looked at how to install flatpak package manager, added flathub repository for flatpak and installed an application using
flatpak command on an Ubuntu 20.04 machine.