解決 ALL MIRROR URLS ARE NOT USING FTP, HTTP[S] OR FILE 問題

全網第一菜雞發表於2021-10-13

CentOS中執行yum update時,會報如下錯誤:

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
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過後,就不在維護了,使用如下方法解決:

  1. 進入/etc/yum.repos.d/
# cd /etc/yum.repos.d/
  1. 編輯CentOS-Base.repo
# 先備份
# cp CentOS-Base.repo CentOS-Base.repo.old

# 編輯
# vim CentOS-Base.repo
  1. 編輯如下幾個塊
  • [base]
  • [updates]
  • [extras]

內容如下:

[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.10/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.10/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.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  1. 清楚快取
# yum clean all
  1. 重新執行更新
# yum update

執行update時,報錯:Peer cert cannot be verified or peer cert invalid
解決辦法:
原因:yum server 的ca證照不被認可

解決方案:Adding “sslverify=false” in the ‘/etc/yum.conf’ file。

本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章