Centos 6無(wú)法使用yum的解決方法_提示Error: Cannot find a valid baseurl for repo: base

Centos 6無(wú)法使用yum的解決方法_提示Error: Cannot find a valid baseurl for repo: base

最近有網(wǎng)友反饋說(shuō)Centos 6的yum命令無(wú)法使用了,遇到的錯(cuò)誤提示如下:

[root@c8-20 ~]# yum -y install wgetLoaded plugins: fastestmirrorSetting up Install ProcessLoading mirror speeds from cached hostfileYumRepo 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.txtError: Cannot find a valid baseurl for repo: base

CentOS?6已經(jīng)隨著2020年11月的結(jié)束進(jìn)入了EOL(Reaches End of Life),不過(guò)有一些老設(shè)備依然需要支持,CentOS官方也給這些還不想把CentOS 6扔進(jìn)垃圾堆的用戶(hù)保留了最后一個(gè)版本的鏡像,只是這個(gè)鏡像不會(huì)再有更新了。簡(jiǎn)單來(lái)說(shuō)就是官方已經(jīng)拋棄了這個(gè)鏡像。

更換的Vault源我選了兩個(gè),一個(gè)是官方的http://vault.centos.org,使用的北美AWS的服務(wù)器,海外的話(huà)使用這個(gè)就可以;還有一個(gè)是阿里的http://mirrors.aliyun.com/centos-vault/,國(guó)內(nèi)使用這個(gè)不會(huì)卡。

1、首先把fastestmirrors關(guān)了

#編輯vi /etc/yum/pluginconf.d/fastestmirror.conf#修改enable=0

2、先把之前的repo挪到備份,然后下面兩個(gè)二選一

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

3、替換為官方Vault源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Official.repo

或者國(guó)內(nèi)用戶(hù)可以替換為阿里云Vault鏡像

wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Aliyun.repo

4、如果沒(méi)有wget的話(huà),請(qǐng)使用SFTP或者直接nano、vi編輯/etc/yum.repos.d/CentOS-Base.repo!里面的東西替換成這兩個(gè)選一個(gè),國(guó)內(nèi)用第二個(gè)阿里,國(guó)外建議第一個(gè)官方。

5、推薦使用懶人專(zhuān)用一鍵修復(fù)

sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf

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

curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repoyum clean all

yum makecache


轉(zhuǎn)載自:https://www.liuzhanwu.cn/29909.html

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容