RedHat7.4最小化安装没有ifconfig命令

软件环境

  VirtualBox 5.2.8

  rhel-server-7.4-x86_64-dvd.iso

系统环境

  Win10 64 位 8G内存

最小化安装了RedHat7.4之后,进入系统之后使用命令:

[root@localhost ~]# ifconfig
-bash:ifconfig:command not found

使用如下命令:

[root@localhost ~]# /sbin/ifconfig
-bash: /sbin/ifconfig: No such file or directory

同样没有任何结果,这是因为在最小化安装的里面没有ifconfig的相关包,因为在redhat7之后准备把ifconfig命令废除了,这怎么办呢?一是安装;二是使用替代指令
替代指令ip addr,这个指令的显示和ifconfig的显示差不多

[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:b4:d4:69 brd ff:ff:ff:ff:ff:ff
    inet 192.168.3.197/24 brd 192.168.3.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a21a:8e53:54c2:4243/64 scope link 
       valid_lft forever preferred_lft forever

如果要安装

[root@localhost ~]# yum provides ifconfig
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
No matches found
[root@localhost ~]# yum whatprovides ifconfig
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
No matches found

可以看到没有yum的使用权限,这个可以参照另一篇文章的解决办法:http://www.cnblogs.com/nbartchen/p/8565816.html

在解决了RedHat7的yum源问题之后,使用下面的命令进行安装,安装完成后就可以使用ifconfig命令了

[root@localhost ~]# yum install net-tools
原文地址:https://www.cnblogs.com/nbartchen/p/8574484.html