Rootop 服务器运维与web架构

yum仓库配置文件变量$releaseve $arch $basearch含义

官方文档:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-yum#sec-Using_Yum_Variables

9.5.3. Using Yum Variables
You can use and reference the following built-in variables in yum commands and in all yum configuration files (that is, /etc/yum.conf and all .repo files in the /etc/yum.repos.d/ directory):

$releasever
You can use this variable to reference the release version of Red Hat Enterprise Linux.
Yum obtains the value of $releasever from the distroverpkg=value line in the /etc/yum.conf configuration file.
If there is no such line in /etc/yum.conf, then yum infers the correct value by deriving the version number from the redhat-releaseproduct package that provides the redhat-release file.
用 $releasever 变量可以获取rhel发行版。
yum从/etc/yum.conf配置文件中的distroverpkg参数指定的rpm包获取$releasever的值。
如果没有distroverpkg参数配置,那么yum会从 redhat-release 包提供的redhat-release文件推导出版本号。
上面是rhel的官方文档,如果是centos的话,那么就是 centos-release 这个包。

$arch
You can use this variable to refer to the system’s CPU architecture as returned when calling Python’s os.uname() function.
Valid values for $arch include: i586, i686 and x86_64.
获取cpu架构,包括i586、i686、x86_64

$basearch
You can use $basearch to reference the base architecture of the system.
For example, i686 and i586 machines both have a base architecture of i386, and AMD64 and Intel 64 machines have a base architecture of x86_64.
获取cpu架构组,比如 i386、x86_64

[root@MiWiFi-RA69-srv etc]# cat /etc/yum.conf 
略```
distroverpkg=centos-release

[root@MiWiFi-RA69-srv etc]# rpm -qi centos-release
Name        : centos-release
Version     : 7
Release     : 3.1611.el7.centos

版本号就是7
如:阿里云centos7.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/

根据变量解析出来就是
http://mirrors.aliyun.com/centos/7/os/x86_64/
http://mirrors.aliyuncs.com/centos/7/os/x86_64/
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/4912.html

作者:Venus

专注于 服务器运维与web架构 E-mail:venus#rootop.org

评论已关闭。