最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Yum的变量学习笔记
时间:2014-04-10 编辑:简简单单 来源:一聚教程网
代码如下 | 复制代码 |
http://mirrors.aliyun.com/centos/%24releasever/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found |
下面我们来看看这个是怎么回事,最好的参考文档当然是man,通过man yum.conf 查看这个$releasever
代码如下 | 复制代码 |
$releasever This will be replaced with the value of the version of the package listed in distroverpkg. This defaults to the ver- $arch This will be replaced with your architecture as listed by os.uname()[4] in Python. $basearch This will be replaced with your base architecture in yum. For example, if your $arch is i686 your $basearch will be $YUM0-$YUM9 These will be replaced with the value of the shell environment variable of the same name. If the shell environment |
可以看到 yum中有这几个变量: $releaserver、$arch、$basearch和用户自定义的$YUM0-$YUM9。
有一个简单的python命令可以看到yum的 releaserver、arch、basearch的值
代码如下 | 复制代码 |
/usr/bin/python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)' |
对于Yum正常的机器,releaserver变量都有定义
代码如下 | 复制代码 |
{'arch': 'ia32e', |
而对于今天Yum有问题的机器,releasever没有定义
代码如下 | 复制代码 |
{'arch': 'ia32e', |
变量$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 |
distroverpkg 定义了一个包名,通过这个包命,执行yum whatprovides $distroverpkg yum就知道了系统的发行版本。
这里默认的值是redhat-release。
对于正常的CentOS系统。执行yum whatprovides redhat-release 可以看到结果
代码如下 | 复制代码 |
10:centos-release-5-10.el5.centos.x86_64 : CentOS release file 10:centos-release-5-10.el5.centos.x86_64 : CentOS release file |
而对于今天遇到的yum有问题的机器,执行这个命令则没有结果。
相关文章
- Laravel 5.3 Blade 模板新增 $loop 变量学习笔记 08-02
- win11内核隔离和内存完整性介绍 10-31
- win10全屏缩放设置教程 10-31
- win10系统备份出错解决教程 10-31
- win10打开软件每次都要询问解决教程 10-31
- win10更新驱动后设备出现异常解决教程 10-31