在CentOS安裝以后蜻懦,執(zhí)行ifconfig發(fā)現(xiàn)命令找不到姨夹,需要安裝
[root@localhost ~]# ifconfig
-bash: ifconfig: command not found
首先設(shè)置yum源纤垂,設(shè)置為阿里的鏡像,這樣速度會快很多
- 備份磷账,防止更改失敗
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 從阿里的鏡像峭沦,下載新的CentOS-Base.repo
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
-bash: wget: command not found
發(fā)現(xiàn)wget并沒有安裝,需要先安裝wget逃糟,成功
[root@localhost yum.repos.d]# yum install wget
安裝結(jié)束后再次重試下載新的CentOS-Base.repo
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2020-07-15 09:21:01-- http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.193.244.231, 124.200.113.115, 124.200.113.111, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.193.244.231|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’
100%[====================================================================================================================================================================================================>] 2,523 --.-K/s in 0s
2020-07-15 09:21:01 (337 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
- 使用yum安裝ifconfig
首先對ifconfig進(jìn)行查找
[root@localhost yum.repos.d]# yum search ifconfig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
============================================================================================================= Matched: ifconfig ==============================================================================================================
net-tools.x86_64 : Basic networking tools
發(fā)現(xiàn)它在net-tools.x86_64這個包里面吼鱼,直接使用yum安裝,安裝后再試試ifconfig已經(jīng)能夠運行绰咽。
[root@localhost ~]# ifconfig -a
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.4 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::2d47:804c:6877:7ceb prefixlen 64 scopeid 0x20<link>
ether 08:00:27:0f:83:3f txqueuelen 1000 (Ethernet)
RX packets 8195 bytes 11784042 (11.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4074 bytes 257812 (251.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.31.95 netmask 255.255.255.0 broadcast 192.168.31.255
inet6 fe80::e4f5:6544:8b5c:9ea6 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:3d:0e:64 txqueuelen 1000 (Ethernet)
RX packets 39293 bytes 4918546 (4.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1323 bytes 213003 (208.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 16 bytes 1408 (1.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 16 bytes 1408 (1.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0