YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
一开始这个遇到这个问题,去百度找了好几个回答,都是说DNS配置不正确,防火墙没关,还有让修改网络适配器为桥接模式,于是盲目的跟着修改,发现压根没用。于是,只能静下心来思考,慢慢找出真正原因。一、首先确保我的虚拟机网络是通的。网卡域名服务器配置:cat /etc/sysconfig/network-scripts/ifcfg-eth0然后cat/etc/resolv.conf,这里的nameserv
一开始这个遇到这个问题,去百度找了好几个回答,都是说DNS配置不正确,防火墙没关,还有让修改网络适配器为桥接模式,于是盲目的跟着修改,发现压根没用。于是,只能静下心来思考,慢慢找出真正原因。
一、首先确保我的虚拟机网络是通的。
网卡域名服务器配置:
cat /etc/sysconfig/network-scripts/ifcfg-eth0
然后cat /etc/resolv.conf,这里的nameserver与网卡配置中的DNS配置对应就可。
search localdomain
nameserver 223.5.5.5
nameserver 223.6.6.6
测试网络是否通:ping www.baidu.com
网络是通的,排除DNS域名,防火墙没关,网络适配器必须修改为桥接这种可能性。
二、网上还有些人说是/etc/yum.repos.d/CentOS-Base.repo这个文件的配置问题,注释掉mirrorlist这个配置项就能成功,试下看看。
mirrorlist都注释掉了,执行sudo yum update试试
还是没能成功,但是报错信息不是All mirror URLs are not using ftp, http[s] or file.了,而是404 not find
于是猜想,应该是配置中的链接访问不了,然后把baseurl这个配置的链接去浏览器访问:http://mirror.centos.org/centos/
r
e
l
e
a
s
e
v
e
r
/
u
p
d
a
t
e
s
/
releasever/updates/
releasever/updates/basearch/
果然是404!!!原来是这个外国站点挂了。
三、解决404问题,把源站点配置改为国内清华大学站点https://mirrors.tuna.tsinghua.edu.cn/centos-vault,最终成功。
这里参考了这位老兄的文章,https://blog.csdn.net/fangeqin/article/details/106170479?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.control
确认清华大学站点能访问:
修改yum源站点配置:vi /etc/yum.repos.d/CentOS-Base.repo
对照清华大学镜像站中的目录修改后如下:
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/
gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/updates/x86_64/
gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/extras/x86_64/
gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/centosplus/x86_64/
gpgcheck=1
enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/contrib/x86_64/
gpgcheck=1
enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
gpgkey=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.8/os/x86_64/RPM-GPG-KEY-CentOS-6
四、验证 执行yum install vim
搞定。
更多推荐
所有评论(0)