How to install Flatpak applications from Flathub - PragmaticLinux (2024)

Ever wanted to install a desktop application on your Linux PC, but your distribution’s package manager didn’t offer it? With a bit of luck you can find the desktop application on Flathub. Flathub offers an ever growing catalog of Linux desktop applications in the Flatpak format. This article teaches you all the ins-and-outs you need to know, to install desktop applications as a Flatpak from the Flathub online repository.

Background

You can think of a Flatpak as a modern packaging and deployment method for Linux desktop applications. An application installed as a Flatpak runs in a sandbox environment, isolated from the rest of the Linux system. Flathub is an online repository that hosts Flatpak applications.

Let’s compare this to software package management of a traditional Linux distribution. I’ll pick Debian here as an example:

  • On Debian, a desktop application is packaged as a DEB-file. To install a desktop application, you use the apt utility to download and install its DEB-file from the Debian online package repository.
  • With Flatpaks, a desktop application is packaged as a Flatpak-file. To install a desktop application, you use the flatpak utility to download and install its Flatpak-file from the Flathub online repository.

So why bother using Flatpak and Flathub to install desktop applications on your Linux system? Well, here’s the cool thing: Flatpaks are essentially Linux distribution agnostic. Thanks to the sandboxing technology used under the hood, one and the same Flatpak desktop application is compatible with all Linux distributions.

Personally, this is how I use Flatpaks, when I install a Linux distribution on my desktop PC:

  1. Make a list of all the desktop applications that I want and need.
  2. Install as many desktop applications from this list using my distribution’s package manager.
  3. Head over to Flathub and install the missing desktop applications as Flatpaks.

For example, during my last desktop PC install with Debian 10, this resulted in me installing Atom, Eclipse and PyCharm as a Flatpak from Flathub.

This article teaches you all the ins-and-outs you need to know, to install desktop applications as a Flatpak from the Flathub online repository.

Flatpak benefits for Linux desktop users

Let’s assume you want to install a specific desktop application, which is not available in your distribution’s package repository. What do you do? This leaves you with two options really:

  1. Try to find the DEB or RPM package for the desktop application somewhere online. Then install it, while keeping your fingers crossed that it works. But do you known and trust who created the DEB or RPM package? Will the software cause problems in a future distribution upgrade? You can never know for sure, unfortunately.
  2. Track down the sources of the desktop application. Then try to build and install the software application from source code. A valid option, yet it assumes a certain amount of skill level. Often, this approach can make removal of the desktop application tricky.

Thanks to the Flatpak technology, combined with the Flathub online repository, you simply head over to the Flathub website, search for your desktop application and then install its Flatpak. Problem solved.

Fixed release Linux distributions offer great stability, but sometimes desktop applications tend to get outdated. Let’s say you need a feature only offered by the latest version of GIMP. In this case you can remove the older version, using your distribution’s package manager. Afterwards, you simply install the latest version of GIMP as a Flatpak from Flathub.

Flatpak benefits for Linux desktop application developers

Flatpaks offer benefits for Linux desktop application developers as well. Deploying a desktop application involves packaging and testing your desktop application for all Linux distributions. At a minimum:

  • Create the DEB package for Debian
  • Then also create the DEB package for Ubuntu. Similar to the Debian one, but not always 100% the same.
  • Create the RPM package for Fedora
  • Then also create the RPM package for openSUSE. Similar to the Fedora one, but certain dependencies names might be different.

Okay, let’s say you went through this packaging effort. Then you still need to get these packages included in each distribution’s online package repository. This often involves getting to know other developers, interested in sponsoring the upload and inclusion of your packaged desktop application. But then it still takes until the next major distribution release for your desktop application to become available. Alternatively, you could host the packages yourself in your home project on openSUSE’s Build Service (OBS). As great as OBS is, it does lower the likelihood of a desktop user actually finding your desktop application.

Thanks to the Flatpak technology, you only need to learn how to package your desktop application as a Flatpak once. Then upload your desktop application’s Flatpak to the Flathub online repository. From now on all Linux desktop users can find the Flatpak of your desktop application on Flathub and easily install it.

What do you need

To complete the steps presented in this article, you just need a Linux PC with a desktop environment. The distribution itself doesn’t matter, nor does the desktop environment. That’s exactly the benefit of installing a desktop application as a Flatpak. I decided on using Ubuntu 20.04 Budgie, running as a VirtualBox virtual machine.

Throughout this article, we will install the community edition of PyCharm. PyCharm is an integrated development environment (IDE) for Python, developed by JetBrains. I use this one myself for all my Python coding and I can highly recommend it. PyCharm serves as a perfect Flatpak desktop application example for this article. Widely popular amongst Python developers, yet not available on most Linux distributions. Luckily, Flathub offers PyCharm, so we can install it as a Flatpak.

In case you would like to find out more information about the PyCharm IDE, you can refer to these previously published articles featuring PyCharm:

  • Easily create a Python virtual environment with the help of PyCharm
  • Setup and debug a Django app in PyCharm community edition
  • Monitor CPU and RAM usage in Python with PsUtil

Preparing your Linux system for Flatpaks

We just need to perform a few quick and simple steps, to prepare our Linux system for the use of Flatpaks. First we need to install the flatpak utility itself. Afterwards, we register the Flathub online repository with flatpak on our system. This latter step enables us to actually install Flatpak desktop applications, directly from Flathub. Read on to get started.

Install Flatpak on your Linux system

Before we can do anything with Flatpaks on your Linux system, we first need to install the flatpak utility itself. Think of it as the Flatpak equivalent of apt, dnf and zypper. Go ahead and open your terminal program and install the flatpak utility from the command-line:

  • Ubuntu/Debian: sudo apt install flatpak
  • openSUSE: sudo zypper install flatpak
  • Fedora: already installed by default!
How to install Flatpak applications from Flathub - PragmaticLinux (1)

We can now use the flatpak utility on your Linux system. Refer to this web page for a full reference of the flatpak command.

Add the Flathub repository

With the flatpak utility installed on our Linux system, we continue by registering the Flathub remote repository as a known installation source. Run the following command from the terminal to achieve this:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

How to install Flatpak applications from Flathub - PragmaticLinux (2)

Note the message about the XDG_DATA_DIRS environment variable. It basically means that we should restart our Linux system. Otherwise application launchers won’t appear in our desktop environment’s application menu, for installed Flatpak desktop applications. Go ahead and bookmark this tutorial, restart your Linux system, open the bookmark and then continue with the next section of the tutorial.

Install a Flatpak application from Flathub

With our Linux system prepared for Flatpaks, it’s about time to give Flatpaks a try. As mentioned earlier on in the article, we’ll install the PyCharm Community Edition IDE as an example. Point your web browser to the Flathub website and enter PyCharm into the Search apps box. You’ll see two results. One for the Professional edition and one for the Community edition. Click on the latter one:

How to install Flatpak applications from Flathub - PragmaticLinux (3)

On the Flathub page for PyCharm Community Edition, scroll all the way down to the bottom of the page. Here you’ll find the installation instructions:

How to install Flatpak applications from Flathub - PragmaticLinux (4)

To install the PyCharm Community Edition IDE as a Flatpak from the Flathub online repository, run this command from your terminal:

flatpak install flathub com.jetbrains.PyCharm-Community

How to install Flatpak applications from Flathub - PragmaticLinux (5)

Run an installed Flatpak application

After installing the PyCharm Community Edition as a Flatpak from Flathub, it is time to verify that it got installed and that we can run it. When installing a Flatpak, it automatically installs an application launcher as well. This means that you can conveniently start the application by selecting it in your desktop environment’s application menu:

How to install Flatpak applications from Flathub - PragmaticLinux (6)

If for some reason the application launcher does not show up in the application menu, try a logout/login sequence and that should fix it.

Note that you can also start an installed Flatpak application from the terminal, with this command syntax:

flatpak run [REF]

With REF being the name of the installed application. It’s the same name as you specified when installing the Flatpak. So in the case of PyCharm, you could start it from the terminal with this command:

flatpak run com.jetbrains.PyCharm-Community

List all installed Flatpak applications

After a while you might loose track of which desktop applications you installed as a Flatpak. With the list parameter of the flatpak command, you can generate an overview:

flatpak list

How to install Flatpak applications from Flathub - PragmaticLinux (7)

Even though we only installed PyCharm Community Edition, the listing shows four Flatpaks. The other three represent Flatpak dependencies, which PyCharm Community Edition needs to work properly.

Upgrade Flatpak applications

Whenever a new version of a desktop application appears or after resolving security issues, the maintainer of the Flatpak typically releases the new version on Flathub. You do not automatically receive this updated version. You yourself decide if and when you upgrade your Flatpak application(s).

To upgrade all installed Flatpak applications in one go, issue the following command from the terminal:

flatpak update

Instead of upgrading all installed Flatpak applications, you can also just upgrade an individual Flatpak application with this syntax:

flatpak update [REF]

With REF being the name of the installed application. The name is the same as you specified when installing the Flatpak. If you do not remember, simply run the flatpak list command for an overview of all installed Flatpaks. Example for upgrading just PyCharm Community Edition:

flatpak update com.jetbrains.PyCharm-Community

Downgrade a Flatpak application

Did you accidentally upgrade the wrong Flatpak application or does the new version not fulfill your needs or expectations? Not a problem with Flatpaks. At any time you can downgrade a Flatpak application to an older version.

Each time the maintainer of a Flatpak application uploads a new version or fix to Flathub, a commit number is generated. It works a bit like the GIT version control system under the hood. No worries if you are not familiar with this. Just remember that a new version of a Flatpak application on Flathub does not get an actual version number, but a commit string. Let me clarify with an example. Run the following command to generate an overview of all available commits on Flathub for the PyCharm Community Edition Flatpak:

flatpak remote-info --log flathub com.jetbrains.PyCharm-Community

How to install Flatpak applications from Flathub - PragmaticLinux (8)

Based on the command output, we now know that version 2020.3.2 is currently installed on our system. At the bottom of the screenshot you can see that version 2020.3.1 is also available. To downgrade (or upgrade) to a specific commit, you can use this command syntax:

flatpak update --commit=[COMMIT] [REF]

With COMMIT being the long shown commit string (e696b5...) and REF being the name of the installed application. As an example: This command downgrades PyCharm Community Edition from version 2020.3.2 to version 2020.3.1:

sudo flatpak update --commit=e696b5f1e48b0b1493376705a2a1c7962c63b89498e161c54e968a68657872c9 com.jetbrains.PyCharm-Community

How to install Flatpak applications from Flathub - PragmaticLinux (9)

Note that I added sudo to this command to run it with super user privileges. When I tried it without, an error was reported with message: Error: Can’t update to a specific commit without root permissions.

Remove a previously installed Flatpak application

For completion purposes, I’ll present instructions in this section on how to remove an installed Flatpak application. The command syntax to uninstall a Flatpak application:

flatpak uninstall [REF]

In this command, REF specified the name of the installed application. If you do not remember the exact name, simply run the flatpak list command for an overview of all installed Flatpaks. Example for removing PyCharm Community Edition:

flatpak uninstall com.jetbrains.PyCharm-Community

How to install Flatpak applications from Flathub - PragmaticLinux (10)

If you now run the command flatpak list, you’ll notice two things:

  1. PyCharm Community Edition was successfully removed.
  2. Some of its dependencies are still installed.

Therefore, I recommend running this command, to remove dependencies that Flatpaks on your Linux system no longer needs:

flatpak uninstall --unused

How to install Flatpak applications from Flathub - PragmaticLinux (11)

Wrap up

Flatpaks offer a convenient and alternative way to install a desktop application on any type of Linux distribution. Flatpaks are hosted on the Flathub online repository. Thanks to the continuously growing popularity of Flatpaks, the number of Flatpaks available on Flathub gets larger everyday.

Linux desktop users like Flatpaks because:

  • They can install desktop applications not offered by their Linux distribution.
  • They can install a more up-to-date version of a desktop application.

Linux desktop application developers can benefit from Flatpaks because:

  • They only have to package their desktop application one time, as a Flatpak.
  • They only have to upload their packaged desktop application one time, to Flathub.

You only need to complete two steps to bring the power of Flatpaks to your Linux system:

  1. Install the flatpak utility.
  2. Add the Flathub remote repository.

From now on you can search for Flatpaks of your favorite desktop applications on the Flathub website. Once found, you can install them with the command syntax:

flatpak install flathub [REF]

The REF part refers to the name of the desktop application, as shown on the Flathub website. In this article, we installed the PyCharm Community Edition for demonstration purposes. In this case, we installed the PyCharm Community Edition Flatpak from Flathub with command:

flatpak install flathub com.jetbrains.PyCharm-Community

Once you get the hang of it, you’ll notice that installing a Flatpak application from Flathub is just as easy as installing an application using your distribution’s package manager.

How to install Flatpak applications from Flathub - PragmaticLinux (2024)

References

Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 6590

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.