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

最近在CentOS 6上搭建DNS服务器,使用yum下载安装软件报错,如下图:

 

解决方法:

1、先备份CentOS的repo源文件

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

 

2、去阿里云下载repo源

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

 

3、编辑CentOS-Base.repo文件,vim /etc/yum.repos.d/CentOS-Base.repo

  输入 ggdG 回车将所有内容删除,然后粘贴以下内容至文件中,保存退出

# 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-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/centos/$releasever/os/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/os/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/centos/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/centos/$releasever/updates/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/updates/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/centos/$releasever/extras/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/extras/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/centos/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyun.com/centos-vault/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/centos/RPM-GPG-KEY-CentOS-6

 

4、更新repo源

yum clean all
yum update

 

5、安装bind程序

yum install bind-chroot -y --nogpgcheck

 

posted @ 2022-08-26 17:37  凡是過往;皆為序章  阅读(334)  评论(0编辑  收藏  举报