今天刚在Vmware上装了一个Centos玩玩,使用的是最小化安装模式,安装完发现了ifconfig命令找不到,如下图所示

一、解决方案

1、找到ifcfg-ens33文件

此文件的目录在/etc/sysconfig/network-scripts目录下

cd /etc/sysconfig/network-scripts/

2、修改文件属性 ONBOOT

使用vi或vim命令修改文件中的ONBOOT属性为yes即可

--修改文件
vi ifcfg-ens33

 3、重启网络

service network start

4、安装net-tools

yum install net-tools

 至此正常来说都可以正常使用ifcofnig命令了,期间可能会有人碰到一些其他莫名的问题我在这里也总结一下。

5、碰到其他错误如何解决

5.1、在使用yum install net-tools时报错

在运行yum install net-tools时报如下的错误解决方式

There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>

更换yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 此时很多人使用最小化安装没有wget命令,没有的小伙伴可以点击下面的链接下载

http://mirrors.163.com/centos/7/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm

下载好文件后可在虚拟机中使用ip address查看系统的ip使用外部工具xshell连接到linux系统中把文件上传至/opt目录下后,执行命令

rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm

有了wget命令后就可以继续更换yum源

 yum源更换成功后继续装net-tools,此时就能正常进行安装了

 

 

此时在敲出ifconfig大功告成

 

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐