原文出处:razeen -> https://razeen.me/post/how-to-install-tshark-on-centos.htmlhtml
准备在服务器上用tshark抓包,分析一下数据。直接yum install tshark却发现没有这个包。网上搜索一下,各类奇葩安装方式,又是安装apt?又是安装各类环境?我相信既然CentOS已经有了yum这么好的包管理工具,那么必定有更简单的方式。
最后只好在Google上直接用我这蹩脚的英文搜索一下。果真,一句how to install tshark on centos顺利解决了个人问题。
原来一直是本身对yum这个命令了解太少了,平时只会yum install,yum update :first_quarter_moon_with_face: 。那么到底故事如何,客官且听我细细道来。
当我试图直接安装时:python
$ yum install tshark 已加载插件:fastestmirror Loading mirror speeds from cached hostfile 没有可用软件包 tshark。 错误:无须任何处理
那么,该怎么办呢? 原来yum提供了搜索功能。linux
$ 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包。centos
接下来就是咱们熟悉的步骤了==。bash
$ 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怎么安装,更多的是有时候咱们须要扩展本身的知识面,避免重复造轮子。ide
注:rpm离线安装参考安装部分的依赖便可,离线安装的都是.rpm包,提示的是so。工具