Linux netstat命令安装方式

本站所有内容来自互联网收集,仅供学习和交流,请勿用于商业用途。如有侵权、不妥之处,请第一时间联系我们删除!Q群:迪思分享

免费资源网 – https://freexyz.cn/

当服务器未安装 netstat 工具时,查看端口监听状态会提示如下报错 “command not found”。

[root@VM_0_15_linux ~]# netstat -an|grep 9200 -bash: netstat: command not found

如果要使用 netstat 命令,需要先安装工具,安装步骤如下所示。

一、首先配置好本机的 yum 源

[root@VM_0_15_linux ~]# yum repolist all Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile repo id repo name status base/1.1/x86_64 UPEL-1.1 – Base enabled: 7,695 !extras/1.1/x86_64 UPEL-1.1 – Extras disabled updates/1.1/x86_64 UPEL-1.1 – Updates enabled: 208 upel-media UPEL-1.1 – Media disabled repolist: 7,903

二、查看提供命令的工具包

执行如下命令 yum provides */netstat 可以看到提供命令的工具包:

net-tools-2.0-0.22.20131004git.el7.x86_64。

[root@VM_0_15_linux ~]# yum provides */netstat Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile updates/1.1/x86_64/filelists_db | 1.1 MB 00:00:00 ctdb-tests-4.7.1-9.el7_5.x86_64 : CTDB clustered database test suite Repo : base Matched from: Filename : /usr/share/ctdb/tests/eventscripts/stubs/netstat net-tools-2.0-0.22.20131004git.el7.x86_64 : Basic networking tools Repo : base Matched from: Filename : /bin/netstat

三、安装工具包

执行 yum install net-tools 安装命令。

[root@VM_0_15_linux ~]# yum install net-tools Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies –> Running transaction check —> Package net-tools.x86_64 0:2.0-0.22.20131004git.el7 will be installed –> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================= Package Arch Version Repository Size ======================================================================================================================================================================= Installing: net-tools x86_64 2.0-0.22.20131004git.el7 base 305 k Transaction Summary ======================================================================================================================================================================= Install 1 Package Total download size: 305 k Installed size: 917 k Is this ok [y/d/N]: y Downloading packages: net-tools-2.0-0.22.20131004git.el7.x86_64.rpm | 305 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : net-tools-2.0-0.22.20131004git.el7.x86_64 1/1 [upel]: net-tools signature check ok. [upel]: net-tools signature check ok. [upel]: net-tools signature check ok. Verifying : net-tools-2.0-0.22.20131004git.el7.x86_64 1/1 Installed: net-tools.x86_64 0:2.0-0.22.20131004git.el7 Complete!

四、验证测试

利用本地监听的端口 9200 验证工具安装是否正常。

可以正常使用命令,说明安装正常。

[root@VM_0_15_linux ~]# netstat -an|grep 9200 tcp6 0 0 :::9200 :::* LISTEN

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持。 


© 版权声明
THE END
★喜欢这篇文章吗?喜欢的话,麻烦动动手指支持一下!★
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容