yum源中$releasever不能被系统识别
Posted jayce9102
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
二、原因
- yum中的变量$releasever是由/etc/yum.conf中的distroverpkg定义的
-
“distroverpkg=centos-release” #将 $releasever设置为centos-release 这个RPM包的版本号
- centos-release是一个rpm包(通过:rpm可以查询到该软件包并没有被安装)
rpm -q centos-release
三、解决方案
- 由于$releasever无法被识别,无法使用yum安装,可以修改yum源文件,把$releasever全部替换为7(注意先备份源文件)
- 通过yum安装centos-release
yum install centos-release -y - 用备份的yum源文件覆盖修改的yum源文件
参考地址:
https://www.jianshu.com/p/925960eaeb21
https://www.repo.cloudlinux.com/cloudlinux/migrate/release-files/centos/7/x86_64/
以上是关于yum源中$releasever不能被系统识别的主要内容,如果未能解决你的问题,请参考以下文章
yum中$releasever $basearch等变量含义