yum安裝軟件時,提示No package netstat available.的解決方法


1. 序言

如筆者在本機上運行netstat時,提示沒有這個命令,向來簡單粗暴,直接yum -y install netstat,顯然是不能正常安裝的。

[root@hadoop-103 ~]# yum -y install netstat
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                         | 3.6 kB  00:00:00     
extras                                                                                                       | 2.9 kB  00:00:00     
updates                                                                                                      | 2.9 kB  00:00:00     
(1/2): extras/7/x86_64/primary_db                                                                            | 153 kB  00:00:00     
(2/2): updates/7/x86_64/primary_db                                                                           | 5.1 MB  00:00:02     
No package netstat available.
Error: Nothing to do
[root@hadoop-103 ~]# 

這種情況下,怎么辦呢?

2. 使用“yum search”命令

此時可以使用“yum search”來查詢這個命令在哪個包中:

[root@hadoop-103 ~]$ yum search netstat
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
========================================================= Matched: netstat =========================================================
dstat.noarch : Versatile resource statistics tool
net-snmp.x86_64 : A collection of SNMP protocol tools and libraries
net-tools.x86_64 : Basic networking tools    #這里已經給出了netstat命令所在包

接着直接安裝這個包即可:yum -y install net-tools

3.使用“yum whatprovides ”查詢命令所在的包

還可以使用yum whatprovides

[root@hadoop-103 ~]# yum  whatprovides *netstat
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base/7/x86_64/filelists_db                                                                                   | 7.3 MB  00:00:04     
extras/7/x86_64/filelists_db                                                                                 | 207 kB  00:00:00     
updates/7/x86_64/filelists_db                                                                                | 3.0 MB  00:00:01     
1:net-snmp-utils-5.7.2-43.el7.x86_64 : Network management utilities using SNMP, from the NET-SNMP project
Repo        : base
Matched from:
Filename    : /usr/bin/snmpnetstat



net-tools-2.0-0.25.20131004git.el7.x86_64 : Basic networking tools
Repo        : base
Matched from:
Filename    : /bin/netstat



zsh-5.0.2-33.el7.x86_64 : Powerful interactive shell
Repo        : base
Matched from:
Filename    : /usr/share/zsh/5.0.2/functions/_netstat



net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Repo        : @base
Matched from:
Filename    : /bin/netstat



[root@hadoop-103 ~]#

參考鏈接:https://blog.csdn.net/xuejinliang/article/details/52777475


免責聲明!

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



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