Management of Linux software packages simplifies installing, updating, and removing software across various distributions. This annexure introduces tools like dnf,pacman,snap, and flatpak for beginners, focusing on user-friendly package management. Since this book targets beginners, we won’t cover installing software from source, which requires advanced compilation steps.

For Debian-specific management with apt, see Chapter 15.

Why Learn about Linux Software Packages?

Package managers automate dependency handling and updates, ensuring system compatibility. Understanding Linux software package management helps you maintain software efficiently on distributions like Fedora, Arch, and beyond.

Common Package Managers in Linux

Linux distributions use specific package managers:

This annexure focuses on dnf, pacman, snap, flatpak, and AppImage.

Using dnf (Red Hat/Fedora)

dnf manages packages on Fedora and Red Hat systems, resolving dependencies automatically.

Basic dnf Commands

Using pacman (Arch Linux)

pacman is Arch Linux’s lightweight package manager, known for speed and simplicity.

Basic pacman Commands

Modern Package Managers: snap, flatpak, and AppImage

snap and flatpak provide cross-distro, sandboxed apps with built-in dependencies. AppImage offers portable, self-contained applications that don’t require installation.

Using snap

Install snap daemon:

$ sudo dnf install snapd  # Fedora

Enable snap:

$ sudo ln -s /var/lib/snapd/snap /snap

Commands:

Using flatpak

Install flatpak:

$ sudo dnf install flatpak  # Fedora

Add Flathub repository:

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

Commands:

Using AppImage

AppImage provides applications packaged in a way that they can run on many different Linux distributions. No installation is required; simply download the AppImage, make it executable, and run it.

Commands:

Note: You might need to install fuse if you encounter issues running AppImages. For Fedora: sudo dnf install fuse. For Arch: `sudo pacman -S fuse`

Container-Based Tools

docker and podman manage containerized apps in isolated environments.

Install:

$ sudo dnf install podman  # Fedora
$ sudo pacman -S docker    # Arch

Example:

$ podman run hello-world

Managing Repositories

Repositories provide software packages. Add custom repos for extra software.

Fedora

Add EPEL:

$ sudo dnf install epel-release
$ sudo dnf update

Arch Linux

Edit /etc/pacman.conf to enable repositories like multilib.

Cleaning Up

Free space by removing unused packages and cache.

dnf

pacman

Practical Examples

Install tree:

$ sudo dnf install tree  # Fedora
$ sudo pacman -S tree    # Arch
$ tree

Install VLC via flatpak:

$ flatpak install flathub org.videolan.VLC

Practice Time!

Test your skills:

  1. Install tree using dnf or pacman and run tree.
  2. Install VLC via snap or flatpak.
  3. Download and run an AppImage.
  4. Search for “firefox” with dnf or pacman.
  5. Clean up unused packages.

Try This: Install tree and run tree. Share your output on X with #LinuxCommandLine!

Glossary of Commands, Tools, and Shortcuts

Reference: For detailed documentation, visit Linux Manpages.

Command/Tool Description
dnf Manages packages on Fedora/Red Hat.
pacman Manages packages on Arch Linux.
snap Installs sandboxed, cross-distro apps.
flatpak Installs cross-distro apps with dependencies.
AppImage Runs portable, self-contained applications.
docker Runs containerized applications.
podman Daemonless container management tool.

References for Linux Software Packages

Below you will find resources for learning more about Linux software packages.


Previous: Chapter 30 | Next: Annexure B