技术&日志

新安装CentOS没有ifconfig命令?

  • ThinkPad T410
  • 外置USB光驱-系统安装盘
  • CentOS-7(7.4.1708)

问题描述

输入 ifconfig 出现 ifconfig command not found

安装命令包 sudo yum install net-tools 又报错了, could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7 省略部分, 系统是没有联网的.

解决问题

用系统关盘做为安装包源, 并不使用网络源.

step1

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

step2

mount -t iso9660 /dev/cdrom /mnt/cdrom/
vi /etc/yum.repos.d/CentOS-CD.repo

    [CentOS-CD]
    name=CentOS-CD
    baseurl=file:///mnt/cdrom
    gpgcheck=0
    gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7
    enabled=1

yum clean all

yum update

yum search ifconfig

yum install net-tools

此时已安装好, 可以使用ifconfig

相关资料

使用光盘作为yum源安装ifconfig等网络命令
CentOS7:ifconfig command not found
centos 7 minimal安装之后怎么设置 ifconfig 是一个已经淘汰了很多年的命令,建议使用 ip 替代