「YUM」- 杂记

  CREATED BY JENKINSBOT

常用的YUM命令

#!/bin/sh

# 更新缓存,更新本地的YUM缓存:
yum clean all

# 搜索命令,当命令未找到时,查看它所属的软件包:
yum provides $(which yum)

# 检查系统是否存在需要更新的软件:
yum check-update

# 列出所有的可用的安全更新:
yum updateinfo list security all

# 安装指定版本的包:
yum install "<package name>-<version info>"

# 软件包降级
yum downgrade "<package name>-<version info>"

显示软件包所属仓库

How to know from which yum repository a package has been installed?

#!/bin/sh

yum install -y yum-utils
repoquery -i "your-package-name"

查看包中文件

# https://www.cyberciti.biz/faq/rhel-centos-fedora-list-contents-of-package-using-yum-command/
yum install -y yum-utils
repoquery --list "bash"
repoquery -q -l "yum-utils"

# https://www.tecmint.com/list-files-installed-from-rpm-deb-package-in-linux/
rpm -qlp "<pkg name>.rpm"

参考文献

Is it possible to limit yum so that it lists or installs only security updates?
How can I instruct yum to install a specific version of package X?
How to use yum to downgrade or rollback some package updates?