On AlmaLinux and Rocky Linux, programs come as packages from the official package sources. dnf finds, installs, updates and removes them, together with everything they need; it takes the place of apt on Ubuntu. Many popular tools are not in the official sources but in EPEL, an extra package source of the Fedora project. The commands were tested on a dedicated server with AlmaLinux 9, with the network test program iperf3 as an example; run them as root.


1. Find a Program

  • dnf search iperf3: every package with "iperf3" in its name or summary; exact matches are listed first.
  • dnf info iperf3: description, version, size and whether it is installed.
  • dnf provides '*/bin/dig': which package has a command that is not installed yet. The answer is bind-utils.

dnf refreshes its package lists by itself when they are older than a few hours; there is no separate step like apt update.

2. Install

dnf install iperf3

dnf shows what it will install, here iperf3 and under Installing dependencies one helper package, and asks Is this ok [y/N]:; answer y. It ends with Complete!. The program can be used at once: iperf3 --version answers, for example, iperf 3.9. How to use it: Check the Network of Your Linux Server.

3. Update Everything

dnf upgrade

More about updates, automatic security updates and when a restart is needed: Automatic Updates on AlmaLinux and Rocky Linux.

4. Remove and Undo

  • dnf remove iperf3: removes the program, and also the helper packages that were installed only for it.
  • dnf history: a numbered list of everything dnf did. dnf history info 10 shows what step 10 changed, and dnf history undo 10 reverses it, for example removes what step 10 installed.

For example, if the installation of iperf3 is step 10, dnf history undo 10 removes iperf3 together with its helper package, and which iperf3 finds nothing afterwards. Check with dnf history info first: an undo of the wrong step removes something else.

5. EPEL: More Programs

dnf install epel-release
crb enable

The first line adds EPEL, the second switches on the official package source CRB, which some EPEL packages need; it answers CRB repo is enabled and named: crb. From then on, dnf install also finds the EPEL programs. Our guides use EPEL for example for Fail2ban, Certbot, msmtp, restic, htop and ncdu.

ℹ Only from trusted sources

Install programs from the official package sources or EPEL whenever possible. Add other sources or download installation scripts only from the official website of the program: they run with full rights on your server.

Useful Questions

  • Is it installed? rpm -q iperf3 shows the installed version, or package iperf3 is not installed.
  • Which package does a file come from? rpm -qf /usr/bin/iperf3.
  • Which package sources are switched on? dnf repolist.

The same tasks on Ubuntu and Debian: Install, Update and Remove Programs on Ubuntu and Debian With apt.


Related Guides

View all AlmaLinux and Rocky Linux guides

Was this answer helpful? 0 Users Found This Useful (0 Votes)