海天无影Blog

YumRepo Error: All mirror URLs are not using ftp, http[s] or file解决办法

/ 629阅 / 0评 / 0

因为centos老版本逐渐停止维护,所以在使用yum安装程序的时候会提示“YumRepo Error: All mirror URLs are not using ftp, http[s] or file”,解决办法就是将官方源替换成阿里云的源来使用。

1、修改yum配置文件

vi /etc/yum.repos.d/CentOS-Base.repo #打开yum配置文件

2、将下面的配置信息复制替换掉CentOS-Base.repo文件里的内容。注意,里面的信息要根据自己的centos版本做相应的调整。
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-6.5 - Base
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[updates]
name=CentOS-6.5 - Updates
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/updates/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[extras]
name=CentOS-6.5 - Extras
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/extras/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[centosplus]
name=CentOS-6.5 - Plus
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[contrib]
name=CentOS-6.5 - Contrib
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

然后再利用以下命令清理以下缓存就可以了

yum clean all #清除yum缓存
rm -rf /var/cache/yum/ #删除yum缓存文件
yum makecache #重新创建yum缓存

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注