whois command for query domain

คำสั่ง whois เป็นคำสั่งที่ช่วยให้เราสามารถตรวจสอบข้อมูลของโดเมนต่างๆได้โดยตรงซึ่งจะช่วยอำนวยความสะดวกให้กับผู้ดูแลระบบในการตรวจสอบความถูกต้องของโดเมนผ่านคำสั่ง หรือนำไปประยุกต์ใช้ในการเขียน script เพื่อดึงข้อมูลต่างๆมาแสดงและตรวจสอบ เช่นตรวจสอบวันหมดอายุของโดเมน หรือตรวจสอบเจ้าของโดเมน เป็นต้น

การติดตั้ง whois สามารถทำได้ง่ายโดยผ่านคำสั่ง yum โดยในบทความนี้จะพูดถึงตั้งแต่การหา package จนไปถึงการติดตั้ง ซึ่งจะช่วยให้สามารถนำไปประยุกต์ใช้ในการหา package อื่นๆได้

การติดตั้ง whois

  1. ตรวจสอบชื่อ package ที่จะต้องติดตั้ง ด้วยคำสั่ง yum whatprovides และตามด้วย */คำสั่ง ในที่นี้คือ */whois ตามตัวอย่าง

    [shell][root@Ezylinux ~]# yum whatprovides */whois
    Loaded plugins: fastestmirror, presto
    Loading mirror speeds from cached hostfile
    epel/metalink | 4.8 kB 00:00
    base | 3.7 kB 00:00
    epel | 4.3 kB 00:00
    extras | 3.5 kB 00:00
    rpmforge | 1.9 kB 00:00
    sogo-rhel6 | 951 B 00:00
    updates | 3.5 kB 00:00
    updates/primary_db | 4.6 MB 00:00
    updates/filelists_db | 3.4 MB 00:00
    jwhois-4.0-19.el6.x86_64 : Internet whois/nicname client
    Repo : base
    Matched from:
    Filename : /usr/bin/whois[/shell]

  2. เมื่อรันเสร็จแล้วเราจะเห็นว่า pacakage ชื่อ jwhois-4.0-19.el6.x86_64 เป็น package ที่มีไฟล์ whois อยู่ ดังนั้นเราสามารถใช้คำสั่ง yum install ได้เลย ตามตัวอย่างด้านล่าง

    [shell]
    [root@Ezylinux ~]# yum install jwhois
    Loaded plugins: fastestmirror, presto
    Loading mirror speeds from cached hostfile

    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package jwhois.x86_64 0:4.0-19.el6 will be installed
    –> Finished Dependency Resolution

    Dependencies Resolved

    ================================================================================
    Package Arch Version Repository Size
    ================================================================================
    Installing:
    jwhois x86_64 4.0-19.el6 base 104 k

    Transaction Summary
    ================================================================================
    Install 1 Package(s)

    Total download size: 104 k
    Installed size: 294 k
    Is this ok [y/N]: y
    Downloading Packages:
    Setting up and reading Presto delta metadata
    Processing delta metadata
    Package(s) data still to download: 104 k
    jwhois-4.0-19.el6.x86_64.rpm | 104 kB 00:00
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing : jwhois-4.0-19.el6.x86_64 1/1
    Verifying : jwhois-4.0-19.el6.x86_64 1/1

    Installed:
    jwhois.x86_64 0:4.0-19.el6

    Complete!
    [/shell]