Red Hat Enterprise Linux(RHEL)中yum的repo文件详解

Jerry Wang 发表于 2021/12/19 10:06:23 2021/12/19
【摘要】 Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。使用yum help查看所有支持的命令:首先查看/etc/yum.conf的内容:下面逐行介绍...

Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。

使用yum help查看所有支持的命令:

首先查看/etc/yum.conf的内容:

下面逐行介绍这个配置文件里每一行的作用。

cachedir=/var/cache/yum/ b a s e a r c h / basearch/ releasever

指定yum缓存的目录,yum在此存储下载的rpm包和数据库。

在我的server上这个文件夹里的内容如下:

keepcache=0:设置 keepcache=1,yum 在成功安装软件包之后保留缓存的头文件 (headers) 和软件包。默认值为 keepcache=0 不保存

debuglevel=2:调试级别,2代表只记录安装和删除记录

logfile=/var/log/yum.log

gpgcheck=1:有1和0两个选择,分别代表是否是否进行gpg校验,如果没有这一项,默认是检查的。什么是GPG检查?GPG是加密和数字签名的免费工具,大多用于加密信息的传递。除了仅用密码加密外,GPG最大的不同是提供了“公钥/私钥”对。利用一方的“公钥”别人加密信息不再需要告诉密码,随时随地都能发送加密信息。而这种加密是单向的,只有一方的“私钥”能解开加密。数字签名又是另一大使用方向。通过签名认证,别人能确保发布的消息来自一方,而且没有经过修改。

进入目录yum.repos.d,能发现很多.repo文件:

随便打开一个:

[virtualbox]

name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox

baseurl=http://download.virtualbox.org/virtualbox/rpm/el/ r e l e a s e v e r / releasever/ basearch

enabled=1

gpgcheck=1

repo_gpgcheck=1

gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc

name:

是对repository的描述,支持像$releasever $basearch这样的变量;

baseurl=http://download.virtualbox.org/virtualbox/rpm/el/ r e l e a s e v e r / releasever/ basearch

baseurl是服务器设置中最重要的部分,指向了这个repo文件对应的软件安装包的地址。

有了这些repo文件的定义,执行yum install后面跟上包的名字,就能自动从baseurl下载安装包并自动安装了。

今天我试图在Linux 服务器上安装Kyma时,遇到如下错误消息:

E1009 23:51:37.685891 358 start.go:174] Error starting host: Error creating host: Error executing step: Running precreate checks.

: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path.

Retrying.

E1009 23:51:37.686942 358 start.go:180] Error starting host: Error creating host: Error executing step: Running precreate checks.

: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path

================================================================================

An error has occurred. Would you like to opt in to sending anonymized crash

information to minikube to help prevent future errors?

To opt out of these messages, run the command:

minikube config set WantReportErrorPrompt false

================================================================================

Please enter your response [Y/n]:

按照提示,我需要先安装Virtual Box。

VirtualBox 是一款开源虚拟机软件。VirtualBox 是由德国 Innotek 公司开发,由Sun Microsystems公司出品的软件,使用Qt编写,在 Sun 被 Oracle 收购后正式更名成 Oracle VM VirtualBox。Innotek 以 GNU General Public License (GPL) 释出 VirtualBox,并提供二进制版本及 OSE 版本的代码。使用者可以在VirtualBox上安装并且执行Solaris、Windows、DOS、Linux、OS/2 Warp、BSD等系统作为客户端操作系统。现在则由甲骨文公司进行开发,是甲骨文公司xVM虚拟化平台技术的一部份。

这个url提供Virtual Box的安装:

https://www.virtualbox.org/wiki/Linux_Downloads

进入之后,根据Linux不同类型下载对应的安装包:

因为我用的是Oracle RHEL,所以使用RPM-based Linux distributions区域的安装指令:

1. 首先下载oracle_vbox.asc文件到本地:

wget -q https://www.virtualbox.org/download/oracle_vbox.asc

再执行import:

sudo rpm --import oracle_vbox.asc

2. cd 进入目录:/etc/yum.repos.d

新建一个文件virtualbox.repo, 输入如下内容:

1 [virtualbox]

2 name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox

3 baseurl=http://download.virtualbox.org/virtualbox/rpm/el/ r e l e a s e v e r / releasever/ basearch

4 enabled=1

5 gpgcheck=1

6 repo_gpgcheck=1

7 gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc

然后执行命令行yum install VirtualBox-5.2:

打印出的Fingerprint和网站上的一致:7B0F AB3A 13B9 0743 5925 D9C9 5442 2A4B 98AB 5139

选择Y:

yum处理并下载依赖:

依赖分析计算结果:有超过25个依赖包需要下载,总共需要下载80M,安装大小182M。选择Y继续:

Loaded plugins: product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

virtualbox/7Server/x86_64/signature | 181 B 00:00:00

Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc

Importing GPG key 0x98AB5139:

Userid : “Oracle Corporation (VirtualBox archive signing key) info@virtualbox.org

Fingerprint: 7b0f ab3a 13b9 0743 5925 d9c9 5442 2a4b 98ab 5139

From : https://www.virtualbox.org/download/oracle_vbox.asc

Is this ok [y/N]: y

virtualbox/7Server/x86_64/signature | 2.9 kB 00:00:40 !!!

virtualbox/7Server/x86_64/primary_db | 107 kB 00:00:01

Resolving Dependencies

–> Running transaction check

—> Package VirtualBox-5.2.x86_64 0:5.2.18_124319_el7-1 will be installed

–> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libpng15.so.15()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libICE.so.6()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libfontconfig.so.1()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libXt.so.6()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libxcb.so.1()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libGL.so.1()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libXinerama.so.1()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libvpx.so.1()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libXmu.so.6()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libopus.so.0()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libSM.so.6()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libXrender.so.1()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libX11-xcb.so.1()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libSDL-1.2.so.0()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libXcursor.so.1()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libX11.so.6()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Processing Dependency: libXext.so.6()(64bit) for package: VirtualBox-5.2-5.2.18_124319_el7-1.x86_64

–> Running transaction check

—> Package SDL.x86_64 0:1.2.15-14.el7 will be installed

—> Package fontconfig.x86_64 0:2.10.95-11.el7 will be installed

–> Processing Dependency: font(:lang=en) for package: fontconfig-2.10.95-11.el7.x86_64

–> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.10.95-11.el7.x86_64

—> Package libICE.x86_64 0:1.0.9-9.el7 will be installed

—> Package libSM.x86_64 0:1.2.2-2.el7 will be installed

—> Package libX11.x86_64 0:1.6.5-1.el7 will be installed

–> Processing Dependency: libX11-common >= 1.6.5-1.el7 for package: libX11-1.6.5-1.el7.x86_64

—> Package libXcursor.x86_64 0:1.1.14-8.el7 will be installed

–> Processing Dependency: libXfixes.so.3()(64bit) for package: libXcursor-1.1.14-8.el7.x86_64

—> Package libXext.x86_64 0:1.3.3-3.el7 will be installed

—> Package libXinerama.x86_64 0:1.1.3-2.1.el7 will be installed

—> Package libXmu.x86_64 0:1.1.2-2.el7 will be installed

—> Package libXrender.x86_64 0:0.9.10-1.el7 will be installed

—> Package libXt.x86_64 0:1.1.5-3.el7 will be installed

—> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed

—> Package libvpx.x86_64 0:1.3.0-5.el7_0 will be installed

—> Package libxcb.x86_64 0:1.12-1.el7 will be installed

–> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.12-1.el7.x86_64

—> Package mesa-libGL.x86_64 0:17.2.3-8.20171019.el7 will be installed

–> Processing Dependency: mesa-libglapi = 17.2.3-8.20171019.el7 for package: mesa-libGL-17.2.3-8.20171019.el7.x86_64

–> Processing Dependency: libXdamage.so.1()(64bit) for package: mesa-libGL-17.2.3-8.20171019.el7.x86_64

–> Processing Dependency: libXxf86vm.so.1()(64bit) for package: mesa-libGL-17.2.3-8.20171019.el7.x86_64

–> Processing Dependency: libglapi.so.0()(64bit) for package: mesa-libGL-17.2.3-8.20171019.el7.x86_64

–> Processing Dependency: libxshmfence.so.1()(64bit) for package: mesa-libGL-17.2.3-8.20171019.el7.x86_64

—> Package opus.x86_64 0:1.0.2-6.el7 will be installed

–> Running transaction check

—> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed

—> Package libX11-common.noarch 0:1.6.5-1.el7 will be installed

—> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed

—> Package libXdamage.x86_64 0:1.1.4-4.1.el7 will be installed

—> Package libXfixes.x86_64 0:5.0.3-1.el7 will be installed

—> Package libXxf86vm.x86_64 0:1.1.4-1.el7 will be installed

—> Package libxshmfence.x86_64 0:1.2-1.el7 will be installed

—> Package mesa-libglapi.x86_64 0:17.2.3-8.20171019.el7 will be installed

—> Package zvbi-fonts.noarch 0:0.2.35-1.el7 will be installed

–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================

Package Arch Version Repository Size

========================================================================================================

Installing:

VirtualBox-5.2 x86_64 5.2.18_124319_el7-1 virtualbox 76 M

Installing for dependencies:

SDL x86_64 1.2.15-14.el7 rhel_7_server_rpms 204 k

fontconfig x86_64 2.10.95-11.el7 rhel_7_server_rpms 229 k

fontpackages-filesystem noarch 1.44-8.el7 rhel_7_server_rpms 9.9 k

libICE x86_64 1.0.9-9.el7 rhel_7_server_rpms 66 k

libSM x86_64 1.2.2-2.el7 rhel_7_server_rpms 39 k

libX11 x86_64 1.6.5-1.el7 rhel_7_server_rpms 606 k

libX11-common noarch 1.6.5-1.el7 rhel_7_server_rpms 164 k

libXau x86_64 1.0.8-2.1.el7 rhel_7_server_rpms 29 k

libXcursor x86_64 1.1.14-8.el7 rhel_7_server_rpms 30 k

libXdamage x86_64 1.1.4-4.1.el7 rhel_7_server_rpms 20 k

libXext x86_64 1.3.3-3.el7 rhel_7_server_rpms 39 k

libXfixes x86_64 5.0.3-1.el7 rhel_7_server_rpms 18 k

libXinerama x86_64 1.1.3-2.1.el7 rhel_7_server_rpms 14 k

libXmu x86_64 1.1.2-2.el7 rhel_7_server_rpms 71 k

libXrender x86_64 0.9.10-1.el7 rhel_7_server_rpms 26 k

libXt x86_64 1.1.5-3.el7 rhel_7_server_rpms 173 k

libXxf86vm x86_64 1.1.4-1.el7 rhel_7_server_rpms 18 k

libpng x86_64 2:1.5.13-7.el7_2 rhel_7_server_rpms 213 k

libvpx x86_64 1.3.0-5.el7_0 rhel_7_server_rpms 498 k

libxcb x86_64 1.12-1.el7 rhel_7_server_rpms 211 k

libxshmfence x86_64 1.2-1.el7 rhel_7_server_rpms 7.1 k

mesa-libGL x86_64 17.2.3-8.20171019.el7 rhel_7_server_rpms 156 k

mesa-libglapi x86_64 17.2.3-8.20171019.el7 rhel_7_server_rpms 43 k

opus x86_64 1.0.2-6.el7 rhel_7_server_rpms 630 k

zvbi-fonts noarch 0.2.35-1.el7 epel 116 k

Transaction Summary

========================================================================================================

Install 1 Package (+25 Dependent packages)

Total download size: 80 M

Installed size: 182 M

Is this ok [y/d/N]:

看到如下消息,说明VirtualBox成功了:

Installed:

VirtualBox-5.2.x86_64 0:5.2.18_124319_el7-1

Dependency Installed:

SDL.x86_64 0:1.2.15-14.el7 fontconfig.x86_64 0:2.10.95-11.el7

fontpackages-filesystem.noarch 0:1.44-8.el7 libICE.x86_64 0:1.0.9-9.el7

libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.5-1.el7

libX11-common.noarch 0:1.6.5-1.el7 libXau.x86_64 0:1.0.8-2.1.el7

libXcursor.x86_64 0:1.1.14-8.el7 libXdamage.x86_64 0:1.1.4-4.1.el7

libXext.x86_64 0:1.3.3-3.el7 libXfixes.x86_64 0:5.0.3-1.el7

libXinerama.x86_64 0:1.1.3-2.1.el7 libXmu.x86_64 0:1.1.2-2.el7

libXrender.x86_64 0:0.9.10-1.el7 libXt.x86_64 0:1.1.5-3.el7

libXxf86vm.x86_64 0:1.1.4-1.el7 libpng.x86_64 2:1.5.13-7.el7_2

libvpx.x86_64 0:1.3.0-5.el7_0 libxcb.x86_64 0:1.12-1.el7

libxshmfence.x86_64 0:1.2-1.el7 mesa-libGL.x86_64 0:17.2.3-8.20171019.el7

mesa-libglapi.x86_64 0:17.2.3-8.20171019.el7 opus.x86_64 0:1.0.2-6.el7

zvbi-fonts.noarch 0:0.2.35-1.el7

Complete!

要获取更多Jerry的原创文章,请关注公众号"汪子熙".

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区),文章链接,文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件至:cloudbbs@huaweicloud.com进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容。
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。