在使用yum命令执行安装指令时,报错File contains no section headers. file: file:///etc/yum.repos.d/
以及出现 file:///mnt
原因是配置中没有配置yum源
yum 的一切配置信息都储存在yum.repos.d 的目录下
操作:
cd /etc/yum.repos.d
rm -rf ./* #删除所有文件
ls #查看是否有文件,要确保没有其他文件
vim CentOS7.repos
[CentOS7] #按下i 进行输入
name = CentOS-service
baseurl = file:///mnt
enabled = 1
gpgcheck = 0 #结束,按下ESC,输入:wq,回车
yum clean all #清理缓存
yum list #能查看到许多的文件包,说明没问题