Install and Use Flatpak on Rocky Linux 8

This tutorial intends to teach you to Install and Use Flatpak on Rocky Linux 8.

Flatpak is the new way of distributing apps across the Linux universe, irrespective of the distribution. This cross-distro application distribution and deployment framework enable developers to Flatpak setup for apps for all major distributions.

The major hurdles in any Linux app distribution are dependencies, and Flatpak covers that. Flatpak builds bundles the dependencies for the respective apps, and end-users need not worry about it.

With a quick setup for your distributions, you can be ready to explore the world of Flatpak apps. 

Steps To Install and Use Flatpak on Rocky Linux 8

To complete this guide, log in to your server as a non-root user with sudo privileges. For this purpose, you can visit this guide on Initial Server Setup with Rocky Linux 8.

Flatpak Installation on Rocky Linux 8

The Flatpak packages are available in the default Rocky Linux 8 repository. First, update your local package index and install Flatpak by using the command below:

# sudo dnf update -y
# sudo dnf install flatpak -y

Then, verify your Flatpak installation by checking its version:

flatpak --version
Output
Flatpak 1.10.7

Using Flatpak on Rocky Linux 8

Here you can see how to use your Flatpak package manager with the following examples.

Enable Flathub on Rocky Linux 8

Now you need to enable the Flathub before using the Flatpak. Flathub is the place to get and distribute apps for all desktop Linux. It is powered by Flatpak, allowing Flathub apps to run on almost any Linux distribution.

To do this you can use the following command:

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

Search Apps with Flatpak

To search for a specific app, you can use the following syntax:

flatpak search <Application_name>

For example, search for OpenJDK:

flatpak search openjdk
Output
Name      Description               Application ID        Version Branch Remotes
OpenJdk … OpenJdk 8 Sdk extension   …k.Extension.openjdk8         22.08  flathub
OpenJdk … OpenJdk 8 Sdk extension   …k.Extension.openjdk8         21.08  flathub
OpenJdk … OpenJdk 8 Sdk extension   …k.Extension.openjdk8         20.08  flathub
OpenJDK … The LTS (long term suppo… ….Extension.openjdk17         22.08  flathub
OpenJDK … The LTS (long term suppo… ….Extension.openjdk17         21.08  flathub
OpenJDK … The LTS (long term suppo… ….Extension.openjdk17         20.08  flathub
OpenJDK … The LTS (long term suppo… ….Extension.openjdk11         22.08  flathub
OpenJDK … The LTS (long term suppo… ….Extension.openjdk11         21.08  flathub
OpenJDK … The LTS (long term suppo… ….Extension.openjdk11         20.08  flathub
OpenJDK … The LTS (long term suppo… ….Extension.openjdk11         19.08  flathub
OpenJDK … The LTS (long term suppo… ….Extension.openjdk11         18.08  flathub
OpenJDK … The latest version of th… …dk.Extension.openjdk         21.08  flathub
OpenJDK … The latest version of th… …dk.Extension.openjdk         20.08  flathub
OpenJDK … The latest version of th… …dk.Extension.openjdk         19.08  flathub
OpenJDK … The latest version of th… …dk.Extension.openjdk         18.08  flathub

Install an App with Flatpak

When the desired application is searched, you can install it on Rocky Linux 8, using Flatpak. 

flatpak install <Application_name>

For example:

flatpak install openjdk

This will ask you which version you want to install.

Looking for matches…
Found similar ref(s) for ‘openjdk’ in remote ‘flathub’ (system).
Use this remote? [Y/n]: y
Similar refs found for ‘openjdk’ in remote ‘flathub’ (system):

   1) runtime/org.freedesktop.Sdk.Extension.openjdk8/x86_64/21.08
   2) runtime/org.freedesktop.Sdk.Extension.openjdk10/x86_64/18.08
   3) runtime/org.freedesktop.Sdk.Extension.openjdk/x86_64/18.08
   4) runtime/org.freedesktop.Sdk.Extension.openjdk17/x86_64/20.08
   5) runtime/org.freedesktop.Sdk.Extension.openjdk8/x86_64/22.08
   6) runtime/org.freedesktop.Sdk.Extension.openjdk11/x86_64/18.08
   7) runtime/org.freedesktop.Sdk.Extension.openjdk/x86_64/19.08
   8) runtime/org.freedesktop.Sdk.Extension.openjdk17/x86_64/21.08
   9) runtime/org.freedesktop.Sdk.Extension.openjdk11/x86_64/19.08
  10) runtime/org.freedesktop.Sdk.Extension.openjdk/x86_64/20.08
  11) runtime/org.freedesktop.Sdk.Extension.openjdk17/x86_64/22.08
  12) runtime/org.freedesktop.Sdk.Extension.openjdk11/x86_64/20.08
  13) runtime/org.freedesktop.Sdk.Extension.openjdk/x86_64/21.08
  14) runtime/org.freedesktop.Sdk.Extension.openjdk8/x86_64/18.08
  15) runtime/org.freedesktop.Sdk.Extension.openjdk11/x86_64/21.08
  16) runtime/org.freedesktop.Sdk.Extension.openjdk9/x86_64/18.08
  17) runtime/org.freedesktop.Sdk.Extension.openjdk8/x86_64/19.08
  18) runtime/org.freedesktop.Sdk.Extension.openjdk11/x86_64/22.08
  19) runtime/org.freedesktop.Sdk.Extension.openjdk10/x86_64/1.6
  20) runtime/org.freedesktop.Sdk.Extension.openjdk8/x86_64/1.6
  21) runtime/org.freedesktop.Sdk.Extension.openjdk9/x86_64/1.6
  22) runtime/org.freedesktop.Sdk.Extension.openjdk8/x86_64/20.08

Which do you want to use (0 to abort)? [0-22]: 1

When your installation is completed, you will get the following output:

Output
        ID                                      Branch Op Remote  Download
 1. [✓] org.freedesktop.Sdk.Extension.openjdk17 22.08  i  flathub 522.4 MB / 495.0 MB

Installing… ████████████████████ 100%  27.5 MB/s  00:00

Uninstall Apps with Flatpak

To uninstall an App with Flatpak, you can use the following syntax:

flatpak uninstall APP-ID

For example:

flatpak uninstall runtime/org.freedesktop.Sdk.Extension.openjdk17
Output
        ID                                              Branch        Op
 1.     org.freedesktop.Sdk.Extension.openjdk17         22.08         r

Proceed with these changes to the system installation? [Y/n]: y

For more information, you can visit the Flatpak Docs page.

Uninstall or Remove Flatpak

If you no longer want to use Flatpak on Rocky Linux 8, you can easily remove it with the command below:

sudo dnf autoremove flatpak -y

Conclusion

Ease of use isn’t the only appeal to Flatpak. There’s one other major point that can be a bit of a sticky issue with open-source purists.

With Flatpak, you gain access to plenty of proprietary software. For example, you can’t simply install either Zoom or Spotify, or other apps using apt or dnf (not without first locating and adding repositories, and even that might cause you problems). With Flatpak, a whole other world of software is opened for the Linux user. 

Hope you enjoy it. You may be interested in these articles on the orcacore blog:

Install Docker Compose on Rocky Linux 8

Clear Yum Cache on Centos 7

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!