运行yum install 命令报错如下: File contains no section headers.

运行yum install 报错如下File contains no section headers解决方案
步骤1
删除yum.repos.d目录下所有文件

rm -f /etc/yum.repos.d/*  

步骤2
然后重新下载阿里的镜像

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

步骤3
清理缓存

yum clean all

步骤4 可省略
测试下载安装

yum install gcc  
posted @ 2020-12-06 09:25  jack-jin  阅读(2283)  评论(0)    收藏  举报