centos6 YUMREPO ERROR ALL MIRROR URLS ARE NOT USING FTP, HTTP[S] OR FILE
Centos6中执行yum update时,会报如下错误:
[root@mysql yum.repos.d]# yum update Loaded plugins: fastestmirror Determining fastest mirrors YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid release/repo/arch combination/ removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt Error: Cannot find a valid baseurl for repo: base
这是因为在CentOS 6在2020年11月30过后,就不在维护了,直接下架了yum源,现在直接访问yum源网址是404状态。当然可以使用如下方法解决:
1.进入/etc/yum.repos.d/
# cd /etc/yum.repos.d/
2.编辑CentOS-Base.repo
# 先备份 # cp CentOS-Base.repo CentOS-Base.repo.old # 编辑 # vim CentOS-Base.repo
3.编辑如下几个块
-
- [base]
- [updates]
- [extras]
内容如下:
#下面的6.x最好根据自己的系统来 [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://vault.centos.org/6.x/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/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://vault.centos.org/6.x/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/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://vault.centos.org/6.x/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
4.清楚缓存
# yum clean all
5.重新执行更新
以为到这里就结束了,其实并不是,重新执行更新,还有以下报错
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile https://vault.centos.org/6.5/os/x86_64/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalid Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
这是因为原因:yum server 的ca证书不被认可。
6.跳过ca证书验证
Adding “sslverify=false” in the ‘/etc/yum.conf’ file。
[root@mysql yum.repos.d]# cat /etc/yum.conf [main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release sslverify=false
7.重新执行更新
这里可能比较卡,时间会比较长,但是一般出现进度条,基本就没问题了