Earlier today I needed to lookup the origin of some IP’s and I typically use whois but it wasn’t installed on the CentOS server I was working on. Attempting to install whois failed so below there is information on installing whois using the yum package manager on CentOS.
whois Not Installed On CentOS Linux:
- [root@dev ~]# whois
- -bash: whois: command not found
Above you can see that the whois command is not currently installed on this CentOS Linux server. Below we describe how to use yum to search for what package installs whois and then we install the correct package.
Use yum whatprovides To See What Installs A Specific Application On CentOS:
- [root@dev ~]# yum whatprovides *bin/whois*
- Loading "installonlyn" plugin
- Setting up repositories
- Reading repository metadata in from local files
- jwhois.x86_64 3.2.3-8.el5 base
- Matched from:
- /usr/bin/whois
- [root@dev ~]#
As you can see above the jwhois package installs the whois application. The yum whatprovides command can be very useful for figuring out what package installs a specific application.
Install jwhois Package Via Yum On CentOS Linux:
- [root@dev ~]# yum install jwhois
- Loading "installonlyn" plugin
- Setting up Install Process
- Setting up repositories
- pgdg83 100% |=========================| 1.9 kB 00:00
- rpmforge 100% |=========================| 1.1 kB 00:00
- base 100% |=========================| 2.1 kB 00:00
- updates 100% |=========================| 1.9 kB 00:00
- addons 100% |=========================| 951 B 00:00
- ruby 100% |=========================| 951 B 00:00
- extras 2.1 kB 00:00
- Reading repository metadata in from local files
- Parsing package install arguments
- Resolving Dependencies
- --> Populating transaction set with selected packages. Please wait.
- ---> Downloading header for jwhois to pack into transaction set.
- jwhois-3.2.3-8.el5.x86_64 100% |=========================| 9.4 kB 00:00
- ---> Package jwhois.x86_64 0:3.2.3-8.el5 set to be updated
- --> Running transaction check
- Dependencies Resolved
- =============================================================================
- Package Arch Version Repository Size
- =============================================================================
- Installing:
- jwhois x86_64 3.2.3-8.el5 base 95 k
- Transaction Summary
- =============================================================================
- Install 1 Package(s)
- Update 0 Package(s)
- Remove 0 Package(s)
- Total download size: 95 k
- Is this ok [y/N]: y
- Downloading Packages:
- (1/1): jwhois-3.2.3-8.el5 100% |=========================| 95 kB 00:00
- Running Transaction Test
- Finished Transaction Test
- Transaction Test Succeeded
- Running Transaction
- Installing: jwhois ######################### [1/1]
- Installed: jwhois.x86_64 0:3.2.3-8.el5
- Complete!
- [root@dev ~]#
Now that jwhois has been installed you should be able to use whois from the CentOS command line as shown in the below example.
Use whois On CentOS Linux:
- [root@dev etc]# whois 136.165.238.241
- [Querying whois.arin.net]
- [whois.arin.net]
- #
- # Query terms are ambiguous. The query is assumed to be:
- # "n 136.165.238.241"
- #
- # Use "?" to get help.
- #
- #
- # The following results may also be obtained via:
- # http://whois.arin.net/rest/nets;q=136.165.238.241?showDetails=true&showARIN=false
- #
- NetRange: 136.165.0.0 - 136.165.255.255
- CIDR: 136.165.0.0/16
- OriginAS:
- NetName: UNIV-LOUIS
- NetHandle: NET-136-165-0-0-1
- Parent: NET-136-0-0-0-0
- NetType: Direct Assignment
- NameServer: PAN.LOUISVILLE.EDU
- NameServer: HERMES.LOUISVILLE.EDU
- RegDate: 1989-09-04
- Updated: 2004-04-20
- Ref: http://whois.arin.net/rest/net/NET-136-165-0-0-1
- OrgName: University of Louisville
- OrgId: UNIVER-261
- Address: Information Technology: Communications Services
- Address: University of Louisville
- City: Louisville
- StateProv: KY
- PostalCode: 40292
- Country: US
- RegDate: 1989-09-04
- Updated: 2004-04-15
- Ref: http://whois.arin.net/rest/org/UNIVER-261
- OrgAbuseHandle: UOFLA-ARIN
- OrgAbuseName: UofL Abuse
- OrgAbusePhone: +1-502-852-1776
- OrgAbuseEmail: abuse@hermes.louisville.edu
- OrgAbuseRef: http://whois.arin.net/rest/poc/UOFLA-ARIN
- OrgNOCHandle: UOFLN-ARIN
- OrgNOCName: UofL NOC
- OrgNOCPhone: +1-502-852-1776
- OrgNOCEmail: noc@hermes.louisville.edu
- OrgNOCRef: http://whois.arin.net/rest/poc/UOFLN-ARIN
- OrgTechHandle: UOFLH-ARIN
- OrgTechName: UofL Hostmaster
- OrgTechPhone: +1-502-852-1776
- OrgTechEmail: hostmaster@hermes.louisville.edu
- OrgTechRef: http://whois.arin.net/rest/poc/UOFLH-ARIN
- RNOCHandle: UOFLN-ARIN
- RNOCName: UofL NOC
- RNOCPhone: +1-502-852-1776
- RNOCEmail: noc@hermes.louisville.edu
- RNOCRef: http://whois.arin.net/rest/poc/UOFLN-ARIN
- RTechHandle: UOFLH-ARIN
- RTechName: UofL Hostmaster
- RTechPhone: +1-502-852-1776
- RTechEmail: hostmaster@hermes.louisville.edu
- RTechRef: http://whois.arin.net/rest/poc/UOFLH-ARIN
- RAbuseHandle: UOFLA-ARIN
- RAbuseName: UofL Abuse
- RAbusePhone: +1-502-852-1776
- RAbuseEmail: abuse@hermes.louisville.edu
- RAbuseRef: http://whois.arin.net/rest/poc/UOFLA-ARIN
- #
- # ARIN WHOIS data and services are subject to the Terms of Use
- # available at: https://www.arin.net/whois_tou.html
- #
- [root@dev etc]#
The whois application has now been installed and can be used as shown in the above example.