How to get telnet working on CentOS/RHEL and MacOS?

telnet is not available by default on a higher version of CentOS/RHEL and MacOS. But that doesn’t mean you can’t get it installed.

When you run telnet, you will notice the following error.

[[email protected] ~]# telnet
-bash: telnet: command not found
[[email protected] ~]#

To fix this, you need to install telnet and it’s easy.

Installing telnet on CentOS/RHEL

  • Log in to the server as root
  • Run the below command to install
yum -y install telnet

It’ll will download the package and install and show you the complete confirmation as below.

Downloading packages:
telnet-0.17-64.el7.x86_64.rpm                                                                                                              |  64 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:telnet-0.17-64.el7.x86_64                                                                                                                    1/1 
  Verifying  : 1:telnet-0.17-64.el7.x86_64                                                                                                                    1/1 

Installed:
  telnet.x86_64 1:0.17-64.el7                                                                                                                                     

Complete!

Now, you can run telnet

[[email protected] ~]# telnet
telnet>

Have fun!

Installing telnet on MacOS

To install telnet on MacOS, you need to have/install Homebrew.

  • Launch terminal and run the below command to install Homebrew (skip if you already have)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • It will take a few seconds and once done; you will see the success message.
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 4947, done.
remote: Counting objects: 100% (4947/4947), done.
remote: Compressing objects: 100% (4748/4748), done.
remote: Total 4947 (delta 49), reused 337 (delta 7), pack-reused 0
Receiving objects: 100% (4947/4947), 3.99 MiB | 3.17 MiB/s, done.
Resolving deltas: 100% (49/49), done.
Tapped 2 commands and 4731 formulae (4,989 files, 12.4MB).
Already up-to-date.
==> Installation successful!

Great, its time to install telnet using brew command

brew install telnet
  • It will download and install the necessary package. Once done, rerun the telnet.
Chandans-iMac:~ chandan$ telnet
telnet>

It was easy. Isn’t it?

Want to build a career in Sysadmin? Check out this Linux administration online course.