yum報錯解決方法
yum報錯解決手記
幫別人配置環(huán)境,系統是centos 6.5 64位,用yum安裝軟件時(shí)一直報錯,前后一共遇到兩個(gè)錯誤:
錯誤1:
[root@localhost yum.repos.d]# yum install telnet
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
http://www.tjdsmy.cn/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
錯誤2:
[root@localhost etc]# yum install telnet
Loaded plugins: fastestmirror, security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. $releasever is not a valid and current release or hasnt been released yet/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
服務(wù)器的網(wǎng)絡(luò )和dns是沒(méi)問(wèn)題的,yum.repo.d/Centos-Base.repo配置是默認的,其它配置文件不清楚有沒(méi)有改過(guò)。
這兩個(gè)錯誤都是和yum的$releasever變量有關(guān),這個(gè)變量會(huì )讀取centos-release包的內容,解決方法是編輯/etc/yum.conf文件,將distroverpkg改為redhat-release或者centos-release即可
vim /etc/yum.conf
distroverpkg=redhat-release
當然,要保證服務(wù)器有centos-release包,這個(gè)包是隨系統安裝的,而且一般人不會(huì )干掉它