CentOS6 yum命令報錯YumRepo Error: All mirror URLs are not using ftp, http[s] or file,修改yum源后404 Not Found


一、CentOS6 yum命令報錯YumRepo Error: All mirror URLs are not using ftp, http[s] or file

1、網上有些人說是/etc/yum.repos.d/CentOS-Base.repo這個文件的配置問題,注釋掉mirrorlist這個配置項就能成功,試下看看

 mirrorlist都注釋掉了,還是報錯,但是報錯信息不是All mirror URLs are not using ftp, http[s] or file.了,而是404 not find

后來猜想,應該是配置中的鏈接訪問不了,然后把baseurl這個配置的鏈接去瀏覽器訪問,果然是404,原來是這個外國網站掛了。

2、修改yum源:嘗試如下各種方法

方法1)、把源站點配置改為國內清華大學站點https://mirrors.tuna.tsinghua.edu.cn/centos-vault

             修改yum源站點配置:vi /etc/yum.repos.d/CentOS-Base.repo

             對照清華大學鏡像站中的目錄修改后如下:

           

          

          執行yum install openssh-clients,仍報錯404 not found

方法2)、更新yum源為aliyun源

         步驟1、更新yum源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
               (Centos7為:wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
         步驟2、自動加載一下在線更新源:yum list  仍然報錯

后來才知道:CentOS6已經在2020年11月30日停止維護了。centos官方停止了對centos6的所有更新,並且下架了包括官方所有的centos6源,目前阿里、163、清華等centos6源已無法使用。

 更新源還是404錯誤

二、修改yum源后404 Not Found解決方法:

備份配置文件,防止以后出錯后不好恢復

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

執行下面命令,新建CentOS-Base.repo配置:

vim /etc/yum.repos.d/CentOS-Base.repo

復制粘貼如下命令

[centos-office]
name=centos-office
failovermethod=priority
baseurl=https://vault.centos.org/6.10/os/x86_64/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6

保存后退出

執行yum list  正常無報錯

此時即可正常使用yum命令了。

 

 

 

 

          

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM