$releasever $infra $basearch
查看CentOS-Base.repo
[root@localhost yum.repos.d]# cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
查看yum.config
[root@localhost etc]# cat yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
查看手册 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.
通过文件conf看到distroverpkg=centos-release, distroverpkg 定义了一个包名,通过这个包名,执行yum whatprovides $distroverpkg ,
yum就知道了系统的发行版本。
这里默认的值是redhat-release/centos-release
[root@localhost etc]# yum whatprovides centos-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.zju.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirror-hk.koddos.net
centos-release-7-7.1908.0.el7.centos.x86_64 : CentOS Linux release file
Repo : base
centos-release-7-7.1908.0.el7.centos.x86_64 : CentOS Linux release file
Repo : @anaconda
$basearch根据手册可知可当前系统相关,32位系统是i386,64位系统是x86_64
对于值$infra 其值可查看文件/etc/yum/vars/infra,此参数目前尚未使用
[root@localhost vars]# cat infra
stock
因此,baseurl如下:
http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock
http://mirrors.tuna.tsinghua.edu.cn/centos/7.7.1908/os/x86_64/
http://mirrors.neusoft.edu.cn/centos/7.7.1908/os/x86_64/
http://mirrors.ustc.edu.cn/centos/7.7.1908/os/x86_64/
http://mirrors.zju.edu.cn/centos/7.7.1908/os/x86_64/
http://mirrors.nju.edu.cn/centos/7.7.1908/os/x86_64/
http://ftp.sjtu.edu.cn/centos/7.7.1908/os/x86_64/
http://mirror.bit.edu.cn/centos/7.7.1908/os/x86_64/
http://mirror.lzu.edu.cn/centos/7.7.1908/os/x86_64/
http://ftp.tc.edu.tw/Linux/CentOS/7.7.1908/os/x86_64/
http://free.nchc.org.tw/centos/7.7.1908/os/x86_64