How-to

Install dig on CentOS Stream, Rocky Linux and AlmaLinux

Minimal Enterprise Linux installs leave out DNS tools. One package, bind-utils, adds dig, nslookup and host in a few seconds.

What is the install command?

sudo dnf install -y bind-utils
dig -v

On CentOS Stream 9, Rocky Linux 9 and AlmaLinux 9 the package is bind-utils. It contains the client tools from the BIND project: dig, nslookup, host, nsupdate and delv. It does not install or start a DNS server; that would be the separate bind package. dig -v prints the version, confirming the tool runs.

The package name differs on other systems: bind9-dnsutils on Debian and Ubuntu, bind-tools on FreeBSD. Knowing that saves a search when you switch between images.

Why is dig missing in the first place?

Minimal installs keep only what the system needs to boot and be reached. DNS client tools are a convenience, so they are left for you to add. The same applies to traceroute, tcpdump, lsof and bash-completion; installing them together right after the first login saves time later:

sudo dnf install -y bind-utils traceroute tcpdump lsof bash-completion

What if dnf cannot find the package?

  • Metadata is stale or the network is down: run sudo dnf clean all && sudo dnf makecache and check you can reach the mirrors with curl -sI https://dl.rockylinux.org/ or your distribution's equivalent.
  • A repository is disabled: bind-utils lives in AppStream; dnf repolist must list it.
  • Name resolution itself fails: dnf cannot reach mirrors by name. Check /etc/resolv.conf, described below.

Which resolver will dig use?

The first nameserver line in /etc/resolv.conf, unless you name another with @server. On Enterprise Linux, NetworkManager usually writes that file:

cat /etc/resolv.conf
nmcli dev show | grep -i dns

If resolv.conf points to 127.0.0.53, systemd-resolved is active and forwards queries upstream; resolvectl status shows where. Knowing the default matters, because "dig says X" really means "this resolver says X".

How do I run a first useful query?

GoalCommand
Address of a namedig +short app.example.net
Ask a public resolverdig @9.9.9.9 +short app.example.net
Mail serversdig MX example.net +short
Validate DNSSECdelv example.net
Quick lookuphost app.example.net

delv is a lesser-known member of the package: it validates DNSSEC itself and reports "fully validated" or the reason validation failed, which is clearer than reading flags in dig's output.

Is there a lighter alternative?

For simple lookups, getent hosts app.example.net works without any extra package. It goes through the system's normal name resolution, including /etc/hosts, which is exactly what applications see. That makes it the right check when an app fails to resolve a name but dig succeeds: the difference usually lies in /etc/hosts or nsswitch.conf. And resolvectl query answers the same question on systems running systemd-resolved.

What next?

The full set of dig options is in The dig command, and nslookup in The nslookup command. All three Enterprise Linux images install free on every model, x86 and Arm; the differences between them are on the Rocky Linux, AlmaLinux and CentOS Stream pages.

Which machines run these images well?

Any of them. Rocky Linux 9, AlmaLinux 9 and CentOS Stream 9 install free on all 68 models, including the Arm line with arm64 builds, so the commands on this page work the same from the cheapest box to the largest. People who pick the Enterprise Linux family for hosting panels or software certified for that ecosystem often start on the entry or single-CPU lines, shown below with their monthly prices. Each machine includes one IPv4 address, so a DNS tool kit like bind-utils is one of the first things worth adding: you will use dig to check the records you point at that address.

Can I keep the tools updated automatically?

Yes. bind-utils receives security fixes through the normal AppStream updates, so dnf upgrade or the dnf-automatic timer keeps it current with the rest of the system. Enable automatic security updates with dnf install dnf-automatic, set upgrade_type = security in /etc/dnf/automatic.conf and run systemctl enable --now dnf-automatic.timer.

Machines Often Run with Rocky Linux or AlmaLinux

ServerProcessorCores / threadsMemoryStorageNetworkPer monthSmallest order
E1Intel Xeon E3-1240 v34 / 816 GB DDR32x 240 GB SSD2x 1 Gbps$30.52$91.56 (3 months)
S1Intel Xeon E-2276G6 / 1264 GB DDR41x 1 TB NVMe2x 10 Gbps$53.32$53.32 (1 month)
S4Intel Xeon E-2388G8 / 1664 GB DDR41x 1 TB NVMe2x 10 Gbps$87.52$87.52 (1 month)
A1Ampere Altra Q80-3080 / 80256 GB DDR42x 2 TB NVMe2x 25 Gbps$252.11$252.11 (1 month)

Keep Reading

The dig command

Query DNS precisely with dig: record types, short answers, specific resolvers, full delegation traces, reverse lookups and DNSSEC checks.

Open

The nslookup command

Look up DNS records with nslookup on any system, use its interactive mode, switch servers and record types, and know when dig is better.

Open

Rocky Linux

Rocky Linux 9, a free Red Hat compatible rebuild focused on staying bug for bug identical to its upstream.

Open

CentOS Stream

CentOS Stream 9 lets you test the next Red Hat minor release early, on a full machine of your own.

Open

FAQ

Quick Answers

bind-utils. Install it with dnf install bind-utils.

No. It contains client tools only; the server is the separate bind package.

nslookup, host, nsupdate and delv, alongside dig.

dig queries DNS directly, while apps also read /etc/hosts. Compare with getent hosts.

bind9-dnsutils, with dnsutils kept as a transitional name.