yum的$releaser与$basearch

最近配置centos 的yum 源时,想要配置一个通配的yum源,注意到发行的网络yum源的url地址中通常有两个变量

https://vault.centos.org/$releaser/cloud/$basearch/openstack-ussuri/repodata/

等效于以下模式(具体内容视具体操作系统而定):

https://vault.centos.org/8.2.2004/cloud/x86_64/openstack-ussuri/repodata/

两个变量具体含义可通过以下命令查询

[root@haproxy2 ~]# rpm -qi centos-release
Name        : centos-release
Version     : 8.2
Release     : 2.2004.0.1.el8
Architecture: x86_64
Install Date: Fri 17 Jun 2022 02:11:32 PM CST
Group       : System Environment/Base
Size        : 25430
License     : GPLv2
Signature   : RSA/SHA256, Wed 03 Jun 2020 09:09:51 AM CST, Key ID 05b555b38483c65d
Source RPM  : centos-release-8.2-2.2004.0.1.el8.src.rpm
Build Date  : Wed 03 Jun 2020 09:02:49 AM CST
Build Host  : x86-02.mbox.centos.org
Relocations : (not relocatable)
Packager    : CentOS Buildsys <bugs@centos.org>
Vendor      : CentOS
Summary     : CentOS Linux release file
Description :
CentOS Linux release files

具体解析如下:

1. $releaser

含义:当前系统版本号

查询:cat /etc/system-release|awk '{print $4}'

[root@haproxy2 ~]# cat /etc/system-release|awk '{print $4}'
8.2.2004

 

2. $basearch

含义: 操作系统架构(如:arch,x86_64)

查询:arch

[root@haproxy2 ~]# arch
x86_64
[root@haproxy2 ~]# 

 或:uname -m

[root@bigdata-1 ~]# uname -m
x86_64

 

posted @ 2022-06-21 10:59  咿呀哒喏  阅读(313)  评论(0编辑  收藏  举报