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

1. 序言

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

[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 ~]#

這種狀況下,怎麼辦呢?shell

2. 使用「yum search」命令

此時可使用「yum search」來查詢這個命令在哪一個包中:ide

[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-toolsoop

3.使用「yum whatprovides 」查詢命令所在的包

還可使用yum whatprovidesspa

[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.net

相關文章
相關標籤/搜索