【常见问题】CentOS6 yum命令报错YumRepo Error: All mirror URLs are not using ftp, http[s] or file
CentOS6已经在2020年11月30日停止维护了。centos官方停止了对centos6的所有更新,并且下架了包括官方所有的centos6源,目前阿里、163、清华等centos6源已无法使用。
1、更新yum源:
1 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
2(Centos7为:wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo)
2、自动加载一下在线更新源:yum list
3、如果上面执行yum list 仍报错,则按照如下步骤操作:
复制代码
一、备份配置文件,防止以后出错后不好恢复
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
二、执行下面命令,新建CentOS-Base.repo配置:
vim /etc/yum.repos.d/CentOS-Base.repo
三、复制粘贴如下命令:
[centos-office]
name=centos-office
failovermethod=priority
baseurl=https://vault.centos.org/6.10/os/x86_64/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6
四、执行yum list