CentOS 安裝抓包工具wireshark-tshark抓包工具


原文出處:razeen -> https://razeen.me/post/how-to-install-tshark-on-centos.html

准備在服務器上用tshark抓包,分析一下數據。直接yum install tshark卻發現沒有這個包。網上搜索一下,各種奇葩安裝方式,又是安裝apt?又是安裝各種環境?我相信既然CentOS已經有了yum這么好的包管理工具,那么一定有更簡單的方式。
最后只好在Google上直接用我這蹩腳的英文搜索一下。果然,一句how to install tshark on centos順利解決了我的問題。
原來一直是自己對yum這個命令了解太少了,平時只會yum install,yum update :first_quarter_moon_with_face: 。那么到底故事如何,客官且聽我細細道來。
當我試圖直接安裝時:

$ yum install tshark
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
沒有可用軟件包 tshark。
錯誤:無須任何處理

那么,該怎么辦呢? 原來yum提供了搜索功能。

$ yum whatprovides *tshark*
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
base/7/x86_64/filelists_db                                                    | 6.9 MB  00:00:00
epel/x86_64/filelists                                                         |  10 MB  00:00:00
extras/7/x86_64/filelists_db                                                  | 524 kB  00:00:00
updates/7/x86_64/filelists_db                                                 | 2.1 MB  00:00:00
1:bash-completion-extras-2.1-11.el7.noarch : Additional programmable completions for Bash
源    :epel
匹配來源:
文件名    :/usr/share/bash-completion/completions/tshark

wireshark-1.10.14-14.el7.i686 : Network traffic analyzer
源    :base
匹配來源:
文件名    :/usr/sbin/tshark
文件名    :/usr/share/wireshark/tshark.html
文件名    :/usr/share/man/man1/tshark.1.gz

wireshark-1.10.14-14.el7.x86_64 : Network traffic analyzer
源    :base
匹配來源:
文件名    :/usr/sbin/tshark
文件名    :/usr/share/wireshark/tshark.html
文件名    :/usr/share/man/man1/tshark.1.gz

我們可以看到wireshark包已經包含了tshark包。

接下來就是我們熟悉的步驟了==。

$ yum install wireshark
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 wireshark.x86_64.0.1.10.14-14.el7 將被 安裝
--> 正在處理依賴關系 libsmi.so.2()(64bit),它被軟件包 wireshark-1.10.14-14.el7.x86_64 需要
--> 正在處理依賴關系 libcares.so.2()(64bit),它被軟件包 wireshark-1.10.14-14.el7.x86_64 需要
--> 正在檢查事務
---> 軟件包 c-ares.x86_64.0.1.10.0-3.el7 將被 安裝
---> 軟件包 libsmi.x86_64.0.0.4.8-13.el7 將被 安裝
--> 解決依賴關系完成

...

已安裝:
  wireshark.x86_64 0:1.10.14-14.el7

作為依賴被安裝:
    c-ares.x86_64 0:1.10.0-3.el7                                                                        libsmi.x86_64 0:0.4.8-13.el7

完畢!

最后我們驗證一下:

 $ tshark -v
TShark 1.10.14 (Git Rev Unknown from unknown)

Copyright 1998-2015 Gerald Combs <gerald@wireshark.org> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with GLib 2.50.3, with libpcap, with libz 1.2.7, with POSIX
capabilities (Linux), without libnl, with SMI 0.4.8, with c-ares 1.10.0, with
Lua 5.1, without Python, with GnuTLS 3.3.26, with Gcrypt 1.5.3, with MIT
Kerberos, without GeoIP.

Running on Linux 3.10.0-693.11.1.el7.x86_64, with locale zh_CN.UTF-8, with
libpcap version 1.5.3, with libz 1.2.7.
Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz

Built using gcc 4.8.5 20150623 (Red Hat 4.8.5-16).

寫這邊文章並不只是只是為了說明tshark怎么在centos怎么安裝,更多的是有時候我們需要擴展自己的知識面,避免重復造輪子。

注:rpm離線安裝參考安裝部分的依賴即可,離線安裝的都是.rpm包,提示的是so。

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM