How to Install Telnet on CentOS 9 Stream
If you’re looking to drop into a legacy service or just want to test your network connectivity, the old‑school telnet client can still be handy on CentOS 9 Stream. This guide walks you through the quick install and how to get it working in minutes.
Prerequisites: Root or Sudo
You’ll need root privileges (or a user with sudo access) because we’re installing packages from the system repositories. If you’re stuck in a minimal environment, make sure your network is up first—no point adding telnet if you can’t reach any servers.
sudo -i # or use sudo with each command
Step 1: Verify Your Repositories
CentOS 9 Stream ships with the “AppStream” and “BaseOS” repositories by default, but if you’re on a stripped‑down install it might be missing. Check that they’re enabled:
dnf repolist all | grep -E 'appstream|baseos'
If either is marked `disabled`, enable them:
sudo dnf config-manager --set-enabled appstream baseos
Why? The telnet package lives in the BaseOS repo, so we need it to be reachable.
Step 2: Install Telnet
Now that the repos are in place, just pull the client from the standard repository:
sudo dnf install -y telnet
DNF will resolve dependencies and fetch `telnet` along with any necessary libraries. If you get a “No matching Packages found” error, double‑check that your BaseOS repo is enabled—this is the most common hiccup I’ve seen on freshly minted CentOS boxes.
Step 3: Test It Works
Telnet is a simple line‑based protocol, so a quick sanity check is to connect to an open port on a public server. Try reaching `time.nist.gov` on its default port (13):
telnet time.nist.gov 13
You should see something like:
Trying 130.127.5.1... Connected to time.nist.gov. Escape character is '^]'. 55420 2026-02-08 10:37:15 UTC Connection closed by foreign host.
If you get “telnet: command not found,” the install didn’t actually happen—check `/usr/bin/telnet` or reinstall.
Troubleshooting Common Issues
Scenario I’ve seen: After a quick package upgrade on a minimal CentOS image, running `telnet` returns an error because the `dnf-plugins-core` package is missing. That plugin gives us the handy `config-manager` command used above. Fix it with:
sudo dnf install -y dnf-plugins-core
“Telnet fails to connect”
If you can’t reach a target, make sure your firewall allows outbound TCP traffic on the port you’re targeting. A quick test is to use `nc` (netcat) or `curl` first; if those work but telnet doesn’t, the issue is likely with how the server expects the client handshake.
Optional: Install a Telnet Server
If you need a host to listen for incoming telnet sessions (rarely useful today), CentOS ships it in the `telnet-server` package. It runs under `inetd` or `xinetd`. Install and enable:
sudo dnf install -y telnet-server sudo systemctl enable --now xinetd # start the super‑daemon
Add a service entry for telnet in `/etc/xinetd.d/telnet` (or use the default). Remember, telnet transmits data unencrypted—don’t expose it to the open Internet.
That’s all there is to it. Drop into your terminal, run those commands, and you’ll have a working telnet client on CentOS 9 Stream in less time than it takes to brew coffee.