解決CentOS安裝寶塔執(zhí)行yum命令錯(cuò)誤:Error: Cannot find a valid baseurl for repo: base
今天在CentOS系統(tǒng)執(zhí)行yum命令時(shí)出現(xiàn)錯(cuò)誤提示: Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
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
錯(cuò)誤信息大概意思是緩存的鏡像文件里的URL無(wú)效了,所以無(wú)法下載程序文件來(lái)安裝,。
202104020724141855.gif (21.18 KB)
下載附件
2021-7-22 15:56 上傳
Cannot find a valid baseurl for repo base 百度答案不少,但都不能解決問(wèn)題,,最后還是在谷歌找到了解決方法,,其實(shí)也很簡(jiǎn)單,只需依次執(zhí)行如下三行代碼:
- echo "http://vault.centos.org/6.7/os/x86_64/" > /var/cache/yum/x86_64/6/base/mirrorlist.txt
- echo "http://vault.centos.org/6.7/extras/x86_64/" > /var/cache/yum/x86_64/6/extras/mirrorlist.txt
- echo "http://vault.centos.org/6.7/updates/x86_64/" > /var/cache/yum/x86_64/6/updates/mirrorlist.txt
注意: 1,、Centos系統(tǒng)版本號(hào) 代碼中 5.11 是CentOS版本號(hào),,要改為你服務(wù)器安裝的CentOS的版本號(hào),CentOS系統(tǒng)的版本號(hào)用此命令查看:
202104020655401523.gif (1.1 KB)
下載附件
2021-7-22 15:56 上傳
該CentOS系統(tǒng)版本號(hào)是7.4.1708,,所以要把代碼里的 5.11 改為 7.4.1708,。
2、mirrorlist.txt路徑 代碼中的 mirrorlist.txt 路徑要改為錯(cuò)誤提示中給出的路徑,,比如看到下面的提示: removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
mirrorlist.txt 路徑便是: /var/cache/yum/x86_64/6/base/mirrorlist.txt
知道這個(gè)后,,我們依次執(zhí)行前面提到的三行代碼時(shí),把路徑的base改為extras和updates來(lái)執(zhí)行(記得先按第1步更改版本號(hào)),。
|