yun源配置路径:/etc/yum.repos.d/xxx.repo
先看下yun配置文件的内容
[root@py git]# cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
可以看到 里面有几个变量 $basearch $arch等
其实最好的资料就是man手册 这些变量内容 我们可以在man手册里面找到
>> man yum.conf
VARIABLES
There are a number of variables you can use to ease maintenance of yum’s configuration files.
They are available in the values of several options including name, baseurl and commands.
$releasever This will be replaced with the value of the version of the package listed in
distroverpkg. This defaults to the version of ‘redhat-release’ package.
$arch This will be replaced with the architecture or your system as detected by yum.
$basearch This will be replaced with your base architecture in yum. For example, if your
$arch is i686 your $basearch will be i386.
$uuid This will be replaced with a unique but persistent uuid for this machine. The value
that is first generated will be stored in /var/lib/yum/uuid and reused until this file is
deleted.
$YUM0-$YUM9 These will be replaced with the value of the shell environment variable of the
same name. If the shell environment variable does not exist then the configuration file
variable will not be replaced.
这里可以看到 $releasever的值来自distroverpkg 那么distroverpkg是什么呢? 我们继续在man yum.conf里面查找可以看到
distroverpkg The package used by yum to determine the "version" of the distribution. This
can be any installed package. Default is ‘redhat-release’. You can see what provides this
manually by using: "yum whatprovides redhat-release".$arch 是系统架构 执行执行arch命令查看
[root@py git]# arch
x86_64$basearch 这将被你yum所在系统的基础架构所取代
例如 如果您的$ arch是i686 你的$ basearch将是i386
$YUM0 - $YUM9 用户自定义变量
这些将被替换为相同名称的shell环境变量的值 如果shell环境变量不存在 那么配置文件变量将不会被替换
这里有个简单的Python命令可以查看这些值
[root@py git]# /usr/bin/python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'
Loaded plugins: fastestmirror
{'arch': 'ia32e',
'basearch': 'x86_64',
'infra': 'stock',
'releasever': '6',
'uuid': 'e51c4e78-7b06-473c-8605-1c998de5a792'}
本文探讨了yum源配置文件的路径和内容,重点解析了其中的变量如$basearch, $arch等。通过查阅man yum.conf手册,了解到$releasever的值来源于distroverpkg,并解释了$arch对应系统的架构,而$basearch表示系统的基础架构。同时提到了$YUM0到$YUM9这些用户自定义变量的替换规则。文章还建议通过执行Python命令来实际查看这些变量的值。"
125873534,8287093,C#窗体间数据传递技巧详解,"['C#', '窗体设计', '数据传递']
831

被折叠的 条评论
为什么被折叠?



