Install and remove Flatpak software packages

2. Manage Software

πŸ“˜Red Hat Certified System Administrator (RHCSA – EX200)


1. What is Flatpak?

Flatpak is a system for installing and managing software on Linux in a way that is independent of your Linux distribution.

  • Traditional Linux software is installed using RPM (Red Hat, Fedora, CentOS) or DEB (Debian, Ubuntu) packages. These depend on system libraries and versions.
  • Flatpak packages include their own libraries and dependencies, which makes them isolated and reduces conflicts with other software.
  • This is useful in IT environments when multiple applications need different versions of libraries without breaking the system.

Think of Flatpak as self-contained software apps. They are sandboxed, meaning they run safely without interfering with the rest of the system.


2. Installing Flatpak on a RHEL system

Before using Flatpak, you must install Flatpak itself.

  1. Make sure your system is connected to the internet.
  2. Run:
sudo dnf install flatpak
  • dnf is the package manager used in RHEL-based systems.
  • After this, your system can install and manage Flatpak apps.

3. Adding Flatpak Repositories

Flatpak uses repositories to find and install apps. The most common is Flathub.

  1. Add Flathub repository:
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  • remote-add adds a new source of Flatpak packages.
  • --if-not-exists prevents adding the same repo twice.
  1. List all Flatpak remotes (to verify):
flatpak remotes
  • Output shows flathub if added successfully.

4. Searching for Flatpak Applications

Before installing, you can search for software:

flatpak search <application-name>

Example:

flatpak search gimp
  • This searches Flathub for the GIMP image editor.
  • You’ll see the app name, ID, and description.

5. Installing Flatpak Applications

To install a software package using Flatpak:

sudo flatpak install flathub <application-ID>
  • Replace <application-ID> with the exact ID from the search result.
  • Example:
sudo flatpak install flathub org.gimp.GIMP
  • Flatpak will show the app size, dependencies, and ask for confirmation. Type y to proceed.
  • Flatpak apps are installed in /var/lib/flatpak/ (system-wide) or ~/.local/share/flatpak/ (user-only).

6. Running Flatpak Applications

After installation, you can run the app with:

flatpak run <application-ID>

Example:

flatpak run org.gimp.GIMP
  • This is similar to typing the app name in a normal Linux shell.
  • You can also find it in the desktop menu if your GUI is installed.

7. Updating Flatpak Applications

Flatpak apps do not update with dnf. To update:

sudo flatpak update
  • This updates all Flatpak applications installed on the system.
  • You can update a single app too:
sudo flatpak update org.gimp.GIMP

8. Listing Installed Flatpak Applications

To see all apps installed via Flatpak:

flatpak list
  • Output includes App ID, Version, Branch, and Installation source.

9. Removing Flatpak Applications

To remove/uninstall a Flatpak app:

sudo flatpak uninstall <application-ID>

Example:

sudo flatpak uninstall org.gimp.GIMP
  • You can also remove unused runtimes (libraries apps depend on) with:
sudo flatpak uninstall --unused
  • This cleans up unnecessary space on the system.

10. Important Points for the Exam

For RHCSA EX200, you need to:

  1. Install Flatpak itself using dnf.
  2. Add Flathub repository for extra apps.
  3. Search, install, run, update, and remove Flatpak applications.
  4. Understand the difference between system-wide and user installation.
  5. Use commands like:
    • flatpak install, flatpak uninstall, flatpak run
    • flatpak search, flatpak list, flatpak update
    • flatpak remote-add, flatpak remotes

11. IT Environment Example

  • In a Linux server, you might need specific tools like GIMP or Visual Studio Code that require newer libraries than what the system has.
  • Using Flatpak, you can install these tools without changing system libraries, keeping the server stable.
  • Developers can run multiple versions of the same app safely.

βœ… Summary Table of Key Commands

TaskCommand Example
Install Flatpaksudo dnf install flatpak
Add Flathub Repositorysudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Search for Appsflatpak search <app-name>
Install Appsudo flatpak install flathub <app-ID>
Run Appflatpak run <app-ID>
List Installed Appsflatpak list
Update Appssudo flatpak update
Remove Appsudo flatpak uninstall <app-ID>
Remove Unused Runtimessudo flatpak uninstall --unused
Buy Me a Coffee