「CentOS」解决ifconfig未安装问题

1. 问题描述

首先,我的环境是CentOS7,应该是最小安装包版,不然怎么会最基础的ifconfig都不能用哟。

看以下报错:

[root@localhost ~]# ifconfig
-bash: ifconfig: 未找到命令

2. 解决过程

yum search ifconfig  # 最重要的一步(授人以鱼不如授人以渔)
yum install net-tools.x86_64 -y
ifconfig

通过yum搜索ifconfig的安装包。

[root@localhost ~]# yum search ifconfig
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
base                                                                           | 3.6 kB  00:00:00
extras                                                                         | 2.9 kB  00:00:00
updates                                                                        | 2.9 kB  00:00:00
(1/4): base/7/x86_64/group_gz                                                  | 153 kB  00:00:00
(2/4): extras/7/x86_64/primary_db                                              | 206 kB  00:00:00
(3/4): base/7/x86_64/primary_db                                                | 6.1 MB  00:00:03
(4/4): updates/7/x86_64/primary_db                                             | 4.5 MB  00:00:07
=========================================== 匹配:ifconfig ===========================================
net-tools.x86_64 : Basic networking tools

匹配到:net-tools.x86_64,然后通过yum install安装。

[root@localhost ~]# yum install net-tools.x86_64 -y
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 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
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-8.2003.0.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

完毕!

安装完之后,再通过ifconfig测试以下。

[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.15.132  netmask 255.255.255.0  broadcast 192.168.15.255
        inet6 fe80::55fc:fd6a:eec3:25c9  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:81:b6:9d  txqueuelen 1000  (Ethernet)
        RX packets 8692  bytes 12253860 (11.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3236  bytes 220189 (215.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]#

欧克,木有问题!


文章作者: 叶遮沉阳
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 叶遮沉阳 !
  目录