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:
- Red Hat/CentOS/Fedora:
dnf(Dandified Yum) - Arch Linux:
pacman - Cross-Distro:
snap,flatpak,AppImage
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
- Check updates:
$ sudo dnf check-update - Install a package:
$ sudo dnf install package_nameExample:
$ sudo dnf install htop - Upgrade packages:
$ sudo dnf upgrade - Remove a package:
$ sudo dnf remove package_name - Search packages:
$ dnf search keyword - Show package info:
$ dnf info package_name
Using pacman (Arch Linux)
pacman is Arch Linux’s lightweight package manager, known for speed and simplicity.
Basic pacman Commands
- Sync and update system:
$ sudo pacman -Syu - Install a package:
$ sudo pacman -S package_nameExample:
$ sudo pacman -S htop - Remove a package:
$ sudo pacman -R package_name - Search packages:
$ pacman -Ss keyword - Show package info:
$ pacman -Si package_name
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:
- Install a snap:
$ sudo snap install package_nameExample:
$ sudo snap install code --classic - Remove a snap:
$ sudo snap remove package_name - List snaps:
$ snap list
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:
- Install a flatpak:
$ flatpak install flathub org.appnameExample:
$ flatpak install flathub org.videolan.VLC - Remove a flatpak:
$ flatpak uninstall org.appname - List flatpaks:
$ flatpak list
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:
- Download an AppImage:
$ wget https://example.com/application.AppImage - Make it executable:
$ chmod +x application.AppImage - Run the AppImage:
$ ./application.AppImage
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
- Remove unused packages:
$ sudo dnf autoremove - Clean cache:
$ sudo dnf clean all
pacman
- Remove unused packages:
$ sudo pacman -Rns $(pacman -Qdtq) - Clean cache:
$ sudo pacman -Sc
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:
- Install
treeusingdnforpacmanand runtree. - Install VLC via
snaporflatpak. - Download and run an AppImage.
- Search for “firefox” with
dnforpacman. - Clean up unused packages.
Try This: Install
treeand runtree. 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.
- Fedora DNF Documentation
- Arch Linux Pacman Guide
- Snap Documentation
- Flatpak Setup Guide
- AppImage Official Website
Previous: Chapter 30 | Next: Annexure B