CentOS6无法使用yum问题

方法一:一键修复

1 sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
2 
3 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
4 
5 curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
6 
7 yum clean all
8 
9 yum makecache

 

方法二:手动修复

①关闭fastestmirrors

用vi打开fastestmirror.conf文件

vi /etc/yum/pluginconf.d/fastestmirror.conf

修改enable的值,使其为零

enable=0

执行如下命令

sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf

②修改repo

把之前的repo挪入备份

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

替换为官方Vault源(海外服务器)

curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Official.repo

或者替换为阿里云Vault镜像(国内服务器)

curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo

 

posted @ 2022-01-10 18:31  千瞳大人  阅读(252)  评论(0)    收藏  举报