yum源中$releasever不能被系統識別


一、現象

使用yum makecache命令時報錯

[root@MiWiFi-R3L-srv ~]# yum makecache
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article 

 

二、原因

  1. yum中的變量$releasever是由/etc/yum.conf中的distroverpkg定義的
  2. “distroverpkg=centos-release”  #將 $releasever設置為centos-release 這個RPM包的版本號
  3. centos-release是一個rpm包(通過:rpm可以查詢到該軟件包並沒有被安裝)
    rpm -q centos-release

三、解決方案

  1. 由於$releasever無法被識別,無法使用yum安裝,可以修改yum源文件,把$releasever全部替換為7(注意先備份源文件)
  2. 通過yum安裝centos-release
    yum install centos-release -y
  3. 用備份的yum源文件覆蓋修改的yum源文件

參考地址:

https://www.jianshu.com/p/925960eaeb21

https://www.repo.cloudlinux.com/cloudlinux/migrate/release-files/centos/7/x86_64/

 


免責聲明!

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



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