问题描述

在Centos7中查看ip没有ifconfig,使用yum安装ifconfig报错没有可用软件包 ifconfig问题解决
[root@localhost etc]# yum -y install ifconfig
已加载插件:fastestmirror
base                                                                                                                         | 3.6 kB  00:00:00     
extras                                                                                                                       | 2.9 kB  00:00:00     
updates                                                                                                                      | 2.9 kB  00:00:00     
(1/4): extras/7/x86_64/primary_db                                                                                            | 250 kB  00:00:00     
(2/4): base/7/x86_64/group_gz                                                                                                | 153 kB  00:00:00     
(3/4): base/7/x86_64/primary_db                                                                                              | 6.1 MB  00:00:01     
(4/4): updates/7/x86_64/primary_db                                                                                           |  25 MB  00:00:03     
Determining fastest mirrors* base: mirrors.bfsu.edu.cn* extras: mirrors.bfsu.edu.cn* updates: mirrors.bfsu.edu.cn
没有可用软件包 ifconfig。
错误:无须任何处理
原因分析:
在 CentOS 7 中,ifconfig 可能已经被替换为其他命令,例如 ip addr 或 ip a。你可以尝试使用这些命令来查看 IP 地址。
如果你仍然希望安装 ifconfig,并且在使用 yum 安装时遇到错误,可能是因为你的 yum 源配置有问题或者没有找到对应的软件包。
以下是一些可能的解决方法:
- 检查 yum 源:确保你的 yum 源设置正确并且可以正常访问。你可以检查 /etc/yum.repos.d/ 目录下的.repo 文件,确保其中的配置正确。
- 更新 yum 缓存:使用以下命令更新 yum 缓存,以确保可以检测到最新的软件包:yum clean all yum makecache
- 搜索 ifconfig 包:使用 yum 搜索功能来查找是否有可用的 ifconfig 包。例如:
 这将显示与 ifconfig 相关的软件包。yum search ifconfig
解决方案:
-  可以使用 ip addr查询ip
  
-  安装 ifconfig,方法如下[root@localhost etc]# yum search ifconfig 已加载插件:fastestmirror Loading mirror speeds from cached hostfile* base: mirrors.bfsu.edu.cn* extras: mirrors.bfsu.edu.cn* updates: mirrors.bfsu.edu.cn ================================================================== 匹配:ifconfig ================================================================== net-tools.x86_64 : Basic networking tools [root@localhost etc]# yum -y install net-tools.x86_64 已加载插件:fastestmirror Loading mirror speeds from cached hostfile* base: mirrors.bfsu.edu.cn* extras: mirrors.bfsu.edu.cn* updates: mirrors.bfsu.edu.cn 正在解决依赖关系 --> 正在检查事务 ---> 软件包 net-tools.x86_64.0.2.0-0.25.20131004git.el7 将被 安装 --> 解决依赖关系完成依赖关系解决====================================================================================================================================================Package 架构 版本 源 大小 ==================================================================================================================================================== 正在安装:net-tools x86_64 2.0-0.25.20131004git.el7 base 306 k事务概要 ==================================================================================================================================================== 安装 1 软件包总下载量:306 k 安装大小:917 k Downloading packages: 警告:/var/cache/yum/x86_64/7/base/packages/net-tools-2.0-0.25.20131004git.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY-- ETA net-tools-2.0-0.25.20131004git.el7.x86_64.rpm 的公钥尚未安装 net-tools-2.0-0.25.20131004git.el7.x86_64.rpm | 306 kB 00:00:00 从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥 导入 GPG key 0xF4A80EB5:用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5软件包 : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Running transaction check Running transaction test Transaction test succeeded Running transaction正在安装 : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1 验证中 : net-tools-2.0-0.25.20131004git.el7.x86_64 1/1 已安装:net-tools.x86_64 0:2.0-0.25.20131004git.el7 完毕! [root@localhost etc]# 
  
更多精彩文章可扫码关注公主号查看:
 