CIQ

What is Flatpak and How Do You Use It on Rocky Linux?

What is Flatpak and How Do You Use It on Rocky Linux?
December 13, 2023

The default package manager for Rocky Linux is dnf, which stands for Dandified Yum. DNF replaced YUM some time ago and serves as a drop-in replacement for the command-line-only tool for installing, removing, and general management of installed applications.

But DNF isn't the only game in town. Some time ago, universal package managers were created that would dramatically change how software is installed on Linux. Prior to these universal package managers, developers would have to create versions of their software that would work on multiple desktop environments. If a developer didn't offer their app for all of the main desktop environments, their app would either not be available for all users, or installing the app would also install several other dependencies the user might not want.

For example, if an app's target desktop is GNOME, when a KDE Plasma user attempts to install the app, it might wind up installing the full GNOME desktop environment as well.

With universal package managers, that's not the case because the apps include everything they need to run, bundled into a single container. Thanks to the likes of Flatpak (which is one of the most popular universal package managers for Linux), users can install any number of apps, regardless of their desktop environment.

Rocky Linux ships with Flatpak pre-installed, so it's ready to go out of the box. The only caveat is that, unlike Snap (which is another universal package manager), Flatpak is geared primarily toward GUI applications. So, where you can install server software like Nextcloud and WordPress with Snap, you cannot with Flatpak.

However, there are tons of GUI applications available to install on Rocky Linux and if you've installed the OS with a GUI, you have a plethora of applications available.

Let's walk through how Flatpak is used.

What you'll need

The only things you'll need for this are a running instance of Rocky Linux (with a desktop environment) and a user with sudo privileges. You shouldn't have to install Flatpak, as it's generally installed by default on Rocky Linux. If you find Flatpak isn't installed on your instance of Rocky Linux, you can add it with the command _sudo dnf install flatpak -y_. That's it. Let's dive in.

How to install an app with Flatpak

I'm going to demonstrate how to install two different apps. The first, Visual Studio Code, will be done via the command line, and the second using your default web browser.

To install an app with Flatpak, the general command usage is:

flatpak install APPLICATION

Where APPLICATION is the name of the app to install. However, it's not as simple as issuing the command:

flatpak install visualstudiocode

Why is that? Unfortunately, out of the box, Flatpak isn't quite as smart as Snap. Because of that, we have to tell Flatpak where to locate apps, which can be done with the command:

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

The above command defines the remote Flatpak repository, which makes it possible to install apps from Flathub without problems.

With the repository added, you can then install an app like Visual Studio Code like this:

flatpak install visualstudio

Flatpak will then offer its best guess as to what you're looking for, a list that will look something like this:

   1) runtime/com.visualstudio.code.tool.fish/x86_64/22.08
   2) runtime/com.visualstudio.code.tool.podman/x86_64/20.08
   3) app/com.visualstudio.code/x86_64/stable
   4) runtime/com.visualstudio.code.oss.Tools/x86_64/stable
   5) app/com.visualstudio.code.oss/x86_64/stable
   6) app/com.visualstudio.code-oss/x86_64/stable
   7) runtime/com.visualstudio.code.tool.podman/x86_64/21.08
   8) runtime/com.visualstudio.code.tool.podman/x86_64/22.08
   9) runtime/com.visualstudio.code.tool.fish/x86_64/20.08
  10) runtime/com.visualstudio.code.tool.fish/x86_64/21.08

In this case, type 3 and then answer y to the remaining questions.

After the app is installed, you should find it in your desktop menu. If you don't, a quick logout and login will add the menu entry for you (Figure 1).

Figure 1

rockyflatpak1

The Visual Studio Code launcher is now available to the KDE Plasma menu in Rocky Linux

An alternative method

Let's say you don't want to bother using the command line for Flatpak. If that's the case, you can use your default web browser to help with the installation. Let's say you want to install the Nextcloud Desktop application. To do that, open your web browser to the Flathub Nextcloud Desktop app page and click Install (Figure 2).

Figure 2

rockyflatpak2 1024x188

The Nextcloud Desktop entry on Flathub

This will download a file to your Downloads directory. Open your default file manager, navigate to the Downloads, directory, and double-click on the downloaded file. This action will open your default software store (such as GNOME Software or KDE Discover), where you can then click Install (Figure 3) to add the app.

Figure 3

rockyflatpak3

Installing the Nextcloud Desktop app with a GUI

When the installation completes, log out and log back in, and you'll find the Nextcloud Desktop app in your desktop menu.

If you find you want to remove a Flatpak app from Rocky Linux, the command would be something like this:

flatpak remove APPLICATION

Where APPLICATION is the name of the application to be removed.

To update a Flatpak app, the command would be:

flatpak update APPLICATION

Where APPLICATION is the name of the application to be updated.

And that's all there is to install applications on Rocky Linux with Flatpak. This is a great way to add even more software to your OS, especially when it's not available via the default package manager. Do yourself a favor and dig around Flathub to find out what available software might appeal to you and/or your users.

Related posts

2023 Holiday Gift Guide for Rocky Linux Users

2023 Holiday Gift Guide for Rocky Linux Users

Dec 19, 2023

Rocky Linux

Why Rocky Linux Is a Rock-Solid Choice in an Economic Downturn

Why Rocky Linux Is a Rock-Solid Choice in an Economic Downturn

Jan 18, 2023

Rocky Linux

6 Signs That It's Time to Move to Rocky Linux

6 Signs That It's Time to Move to Rocky Linux

Feb 23, 2023

Rocky Linux

123
37
>>>