Windows 中软件包管理控制面板中程序和功能。通过安装将信息注册到系统中。用户下载的绿色软件。例如U盘启动盘工具rufus。软件包来源应用商城第三方官方网站qq、微信。分析 RPM 包Linux 发行版本以 RHEL 为代表的发行版本使用rpm包管理系统RHEL (Red Hat Enterprise LinuxFedora由原来的RedHat桌面版本发展而来免费版本CentOSRHEL的社区克隆版本免费CentOS StreamRHEL的社区克隆版本免费RockyRHEL的社区克隆版本免费OELOralce Enterprise Linux以 Debian 为代表的发行版本使用deb包管理系统Debian社区Linux的典范迄今为止最遵循GNU规范的Linux系统。UbuntuDebian 衍生版是一个以桌面应用为主的Linux操作系统。Kali LinuxDebian 衍生版旨在渗透测试和数字取证。其他版本ArchLinux Gentoo 等等…RPM 包文件名格式redhat 开发了 rpm 包管理提供一个标准的软件版本管理方法比从归档包解压文件到系统简单多了。CentOS 提供的所有软件都是rpm格式。RPM软件包文件名格式name-version-release.architecture.rpm示例lrzsz-0.12.20-36.el7.x86_64.rpmname是描述其内容的一个或多个词语(lrzsz)。version是原始软件的版本号(0.12.20)。release是基于该版本的发行版号由软件打包商设置后者不一定是原始软件开发商(36.el7)。architecture是编译的软件包运行的处理器架构。noarch表示此软件包不限定架构。x86_64表示此软件包限定x86 64位。aarch64表示此软件包限定ARM 64位。RPM 包组成每个rpm包涵三个部分需要安装的文件。包的元数据信息包括包的名称、版本、架构等软件包说明软件包依赖关系许可证更变日志其他信息。脚本软件包安装更新卸载需要执行的脚本。通常软件提供商使用GPG密钥对RPM软件包进行数字签名Red Hat会对其发布的所有软件包进行数字签名。 RPM系统通过确认包由相应的GPG密钥签名来验证包的完整性。 如果GPG签名不匹配RPM系统拒绝安装包。复习非对称加密非对称加密有一对公钥和私钥。公钥分享给别人用来加密数据。私钥自己保留用来解密公钥加密的数据。Linux中rpm包会被私钥签名客户端使用公钥验证签名确保文件的完整性。RPM 包安装和更新如果同一个软件有多个版本只需安装最高版本。在大多数情况下一个软件只能安装一个版本。 kernel是个例外。如果构建包的文件名没有冲突则可以安装多个版本。 由于只能通过引导到该内核来测试新内核因此特定设计了包以便可以一次安装多个版本。如果内核无法启动则旧内核仍然可用且可引导。软件包升级只需要安装最新版本不需要逐步升级。升级RPM包将删除旧版本的软件包并安装新版本通常会保留配置文件。rpm 命令查询重点基本语法rpm {-q|--query} [select-options] [query-options] select-options [PACKAGE_NAME] [-a,--all] [-f,--file FILE] [-g,--group GROUP] {-p,--package PACKAGE_FILE] [--hdrid SHA1] [--pkgid MD5] [--tid TID] [--querybynumber HDRNUM] [--triggeredby PACKAGE_NAME] [--whatprovides CAPABILITY] [--whatrequires CAPABILITY] query-options [--changelog] [-c,--configfiles] [--conflicts] [-d,--docfiles] [--dump] [--filesbypkg] [-i,--info] [--last] [-l,--list] [--obsoletes] [--provides] [--qf,--queryformat QUERYFMT] [-R,--requires] [--scripts] [-s,--state] [--triggers,--triggerscripts]示例# 查询系统中安装了哪些软件包[rootlocalhost ~16:13:56]# rpm -qavirt-what-1.18-4.el7_9.1.x86_64 grub2-common-2.02-0.87.0.1.el7.centos.9.noarch firewalld-filesystem-0.6.3-13.el7_9.noarch setup-2.8.71-11.el7.noarch sg3_utils-1.37-19.el7.x86_64 basesystem-10.0-7.el7.centos.noarch......# 查询系统中某个软件包是否安装[rootlocalhost ~16:41:59]# rpm -q httpd未安装软件包 httpd[rootlocalhost ~16:42:06]# rpm -q kernelkernel-3.10.0-1160.71.1.el7.x86_64# 查询系统中某个已安装的软件包元数据信息[rootlocalhost ~16:42:16]# rpm -q kernel -iName:kernel Version:3.10.0 Release:1160.71.1.el7 Architecture: x86_64 Install Date:2026年05月13日 星期三19时50分28秒 Group:System Environment/Kernel Size:67412549License:GPLv2 Signature:RSA/SHA256,2022年06月30日 星期四22时25分23秒, Key ID 24c6a8a7f4a80eb5 Source RPM:kernel-3.10.0-1160.71.1.el7.src.rpm Build Date:2022年06月28日 星期二23时55分05秒 Build Host:kbuilder.bsys.centos.org Relocations:(not relocatable)Packager:CentOS BuildSystemhttp://bugs.centos.orgVendor:CentOS URL:http://www.kernel.org/ Summary:The Linux kernel Description:The kernel package contains the Linux kernel(vmlinuz), the core of any Linux operating system. The kernel handles the basic functions of the operating system: memory allocation, process allocation, device input and output, etc.# 查询系统中某个已安装的软件包包涵哪些文件[rootlocalhost ~16:43:50]# rpm -q openssh-server -l/etc/pam.d/sshd /etc/ssh/sshd_config /etc/sysconfig/sshd /usr/lib/systemd/system/sshd-keygen.service /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.socket /usr/lib/systemd/system/sshd.service /usr/lib64/fipscheck/sshd.hmac /usr/libexec/openssh/sftp-server /usr/sbin/sshd /usr/sbin/sshd-keygen /usr/share/man/man5/moduli.5.gz /usr/share/man/man5/sshd_config.5.gz /usr/share/man/man8/sftp-server.8.gz /usr/share/man/man8/sshd.8.gz /var/empty/sshd# 查询系统中某个已安装的软件包包涵哪些配置文件[rootlocalhost ~16:44:33]# rpm -q openssh-server -c/etc/pam.d/sshd /etc/ssh/sshd_config /etc/sysconfig/sshd# 查询系统中某个已安装的软件包包涵哪些文档文件[rootlocalhost ~16:45:20]# rpm -q openssh-server -d/usr/share/man/man5/moduli.5.gz /usr/share/man/man5/sshd_config.5.gz /usr/share/man/man8/sftp-server.8.gz /usr/share/man/man8/sshd.8.gz# 查询系统中某个某个文件属于哪个已安装的软件包[rootlocalhost ~16:45:36]# rpm -q -f /etc/ssh/sshd_configopenssh-server-7.4p1-23.el7_9.x86_64# 查询系统中某个已安装的软件包包涵的脚本[rootlocalhost ~16:46:05]# rpm -q openssh-server --scriptspreinstall scriptlet(using /bin/sh): getent group sshd/dev/null||groupadd-g74-rsshd||:getentpasswdsshd/dev/null||\useradd-cPrivilege-separated SSH-u74-gsshd\-s/sbin/nologin-r-d/var/empty/sshd sshd2/dev/null||:postinstall scriptlet(using /bin/sh):......# 查询系统中某个已安装的软件包变更日志[rootlocalhost ~16:51:27]# rpm -q openssh-server --changelog* 四7月202023Dmitry Belyavskiydbelyavsredhat.com-7.4p1-23 0.10.3-2 - Avoid remote code executioninssh-agent PKCS#11 supportResolves: CVE-2023-38408 * 四9月302021Dmitry Belyavskiydbelyavsredhat.com-7.4p1-22 0.10.3-2 - avoid segfaultinKerberos cache cleanup(#1999263)- fix CVE-2021-41617(#2008884)......# 下载 httpd 软件包,以及依赖的其他软件包[rootlocalhost ~16:53:12]# yum install -y yum-utils已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本 无须任何处理[rootlocalhost ~16:53:44]# lsanaconda-ks.cfg nginx-1.24.0 nginx-1.24.0.tar.gz[rootlocalhost ~16:53:58]# yumdownloader httpd已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com httpd-2.4.6-99.el7.centos.1.x86_64.rpm|2.7MB 00:00:02[rootlocalhost ~16:54:13]# lsanaconda-ks.cfg httpd-2.4.6-99.el7.centos.1.x86_64.rpm nginx-1.24.0 nginx-1.24.0.tar.gz# 查询系统中某个软件包(package)文件包涵哪些配置文件[rootlocalhost ~16:54:16]# rpm -q -p httpd-2.4.6-99.el7.centos.1.x86_64.rpm -c/etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/userdir.conf /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.modules.d/00-base.conf......# 同样-l -d -i也可以配合-p使用# 查询系统中某个软件包组中包涵哪些软件包[rootlocalhost ~16:55:38]# rpm -qg System Environment/Basegrub2-common-2.02-0.87.0.1.el7.centos.9.noarch centos-release-7-9.2009.1.el7.centos.x86_64 setup-2.8.71-11.el7.noarch......扩展# 查看软件包所在仓库精确位置[rootlocalhost ~17:06:58]# repoquery --location httpdhttp://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/httpd-2.4.6-99.el7.centos.1.x86_64.rpm[rootlocalhost ~17:07:54]# repoquery --location openssh-serverhttp://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/openssh-server-7.4p1-23.el7_9.x86_64.rpm# 此时可以通过 wget 下载特定文件[rootlocalhost ~17:08:05]# wget http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/httpd-2.4.6-99.el7.centos.1.x86_64.rpm验证基本语法rpm {-V|--verify} [select-options] [verify-options] select-options [PACKAGE_NAME] [-a,--all] [-f,--file FILE] [-g,--group GROUP] {-p,--package PACKAGE_FILE] [--hdrid SHA1] [--pkgid MD5] [--tid TID] [--querybynumber HDRNUM] [--triggeredby PACKAGE_NAME] [--whatprovides CAPABILITY] [--whatrequires CAPABILITY] verify-options [--nodeps] [--nofiles] [--noscripts] [--nodigest] [--nosignature] [--nolinkto] [--nofiledigest] [--nosize] [--nouser] [--nogroup] [--nomtime] [--nomode] [--nordev] [--nocaps] [--noconfig] [--noghost]示例# 查看openssh-server软件安装是否有问题没有提示代表安装没有问题[rootlocalhost ~17:09:32]# rpm -V openssh-server# 修改(change)[rootlocalhost ~17:09:49]# sed -i s/PermitRootLogin yes/PermitRootLogin no/g /etc/ssh/sshd_config[rootlocalhost ~17:22:07]# rpm -V openssh-serverS.5....T. c /etc/ssh/sshd_config[rootlocalhost ~17:22:09]# sed -i s/PermitRootLogin no/PermitRootLogin yes/g /etc/ssh/sshd_config# 移走 /etc/ssh/sshd_config 文件再次查看[rootlocalhost ~17:24:27]# mv /etc/ssh/sshd_config .[rootlocalhost ~17:24:35]# rpm -V openssh-server遗漏 c /etc/ssh/sshd_config# 恢复该文件到原来位置[rootlocalhost ~17:24:38]# mv sshd_config /etc/ssh/[rootlocalhost ~17:24:53]# rpm -V openssh-server.......T. c /etc/ssh/sshd_config安装和卸载基本语法rpm {-i|--install} [install-options] PACKAGE_FILE ... install-options [--allfiles] [--badreloc] [--excludepath OLDPATH] [--excludedocs] [--force] [-h,--hash] [--ignoresize] [--ignorearch] [--ignoreos] [--includedocs] [--justdb] [--nocollections] [--nodeps] [--nodigest] [--nosignature] [--noplugins] [--noorder] [--noscripts] [--notriggers] [--oldpackage] [--percent] [--prefix NEWPATH] [--relocate OLDPATHNEWPATH] [--replacefiles] [--replacepkgs] [--test]示例# 下载软件包[rootlocalhost ~20:09:41]# repoquery --location lrzszhttp://mirrors.aliyun.com/centos/7/os/x86_64/Packages/lrzsz-0.12.20-36.el7.x86_64.rpm[rootlocalhost ~20:10:31]# wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/lrzsz-0.12.20-36.el7.x86_64.rpm--2026-05-1820:10:51-- http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/lrzsz-0.12.20-36.el7.x86_64.rpm 正在解析主机 mirrors.aliyun.com(mirrors.aliyun.com)...36.156.107.55,36.156.3.115,36.156.107.54,... 正在连接 mirrors.aliyun.com(mirrors.aliyun.com)|36.156.107.55|:80... 已连接。 已发出 HTTP 请求正在等待回应...200OK 长度79376(78K)[application/x-rpm]正在保存至: “lrzsz-0.12.20-36.el7.x86_64.rpm”100%[]79,376--.-K/s 用时0.01s2026-05-1820:10:51(6.02MB/s)- 已保存 “lrzsz-0.12.20-36.el7.x86_64.rpm”[79376/79376])# 安装[rootlocalhost ~20:11:00]# rpm -i lrzsz-0.12.20-36.el7.x86_64.rpm软件包 lrzsz-0.12.20-36.el7.x86_64 已经安装[rootlocalhost ~20:11:54]# rpm -q lrzszlrzsz-0.12.20-36.el7.x86_64# 卸载[rootlocalhost ~20:12:03]# rpm -e lrzsz[rootlocalhost ~20:12:46]# rpm -q lrzsz未安装软件包 lrzsz# 友好方式安装[rootlocalhost ~20:12:51]# rpm -ivh lrzsz-0.12.20-36.el7.x86_64.rpm准备中...################################# [100%]正在升级/安装...1:lrzsz-0.12.20-36.el7################################# [100%]# 友好方式卸载[rootlocalhost ~20:13:11]# rpm -evh lrzsz准备中...################################# [100%]正在清理/删除...1:lrzsz-0.12.20-36.el7################################# [100%]# 安装 httpd报错如下下一节讲解如下解决# 安装准备确保系统中没有提供httpd需要的依赖包[rootlocalhost ~20:13:27]# rpm -e apr apr-util httpd-tools mailcap错误未安装软件包 apr 错误未安装软件包 apr-util 错误未安装软件包 httpd-tools 错误未安装软件包 mailcap[rootlocalhost ~20:15:21]# rpm -ivh httpd-2.4.6-99.el7.centos.1.x86_64.rpm错误依赖检测失败 /etc/mime.types 被 httpd-2.4.6-99.el7.centos.1.x86_64 需要 httpd-tools2.4.6-99.el7.centos.1 被 httpd-2.4.6-99.el7.centos.1.x86_64 需要 libapr-1.so.0()(64bit)被 httpd-2.4.6-99.el7.centos.1.x86_64 需要 libaprutil-1.so.0()(64bit)被 httpd-2.4.6-99.el7.centos.1.x86_64 需要重新安装rpm{--reinstall}[install-options]PACKAGE_FILE...示例[rootlocalhost ~20:15:50]# rpm --reinstall -vh lrzsz*准备中...################################# [100%]正在升级/安装...1:lrzsz-0.12.20-36.el7################################# [100%]提取 RPM 包中文件Windows 提取使用压缩工具例如360压缩打开rpm包浏览和提取。Linux 提取了解一步提取所有文件[rootlocalhost ~ 20:16:12]# rpm2cpio httpd-2.4.6-99.el7.centos.1.x# 使用 yum 管理软件包 ## yum 介绍 - rpm 命令是一个管理软件包的工具不适用于软件包存储库或自动解决来自多个源的依赖项。 - YumYellowdog Updater Modified旨在成为管理基于RPM的软件安装和更新的更好系统。yum命令允许安装更新删除和获取有关软件包及其依赖项的信息。 ## yum 命令 ### help 作用 bash # 查看yum命令帮助信息 [rootlocalhost ~ 20:23:46]# yum helpinfo作用查看仓库中某个软件包信息# 查看仓库中httpd包信息[rootlocalhost ~20:24:14]# yum info httpd已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 可安装的软件包 名称 httpd 架构 x86_64 版本 2.4.6 发布 99.el7.centos.1 大小 2.7 M 源 updates/7/x86_64 简介 Apache HTTP Server 网址 http://httpd.apache.org/ 协议 ASL2.0描述 The Apache HTTP Server is a powerful, efficient, and extensible:web server.list作用查询软件包清单# 查看仓库中http开头的包有哪些[rootlocalhost ~20:24:24]# yum list http*已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 可安装的软件包 http-parser.i6862.7.1-9.el7 base http-parser.x86_642.7.1-9.el7......# 查看仓库中httpd包有哪些版本[rootlocalhost ~20:25:26]# yum list httpd --showduplicates已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 可安装的软件包 httpd.x86_642.4.6-95.el7.centos base httpd.x86_642.4.6-97.el7.centos updates httpd.x86_642.4.6-97.el7.centos.1 updates httpd.x86_642.4.6-97.el7.centos.2 updates httpd.x86_642.4.6-97.el7.centos.4 updates httpd.x86_642.4.6-97.el7.centos.5 updates httpd.x86_642.4.6-98.el7.centos.6 updates httpd.x86_642.4.6-98.el7.centos.7 updates httpd.x86_642.4.6-99.el7.centos.1search了解作用根据关键字搜索软件包# 查看简介包含关键字的软件包[rootlocalhost ~20:25:30]# yum search web server# 查看描述和简介包含关键字的软件包[rootlocalhost ~20:26:12]# yum search all web serverprovides作用查看仓库中哪个包可以提供相应文件# 查看仓库中哪个包可以提供文件sar程序[rootlocalhost ~20:26:49]# yum provides sar已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com docker-ce-stable/7/x86_64/filelists_db|66kB 00:00:00 mirrors.aliyun.com_kubernetes_yum_repos_kubernetes-el7-x86_64_/filelists|45kB 00:00:00 sysstat-10.1.5-19.el7.x86_64:Collection of performance monitoring toolsforLinux 源 base 匹配来源 文件名 /usr/bin/sar sysstat-10.1.5-20.el7_9.x86_64:Collection of performance monitoring toolsforLinux 源 updates 匹配来源 文件名 /usr/bin/sar sysstat-10.1.5-20.el7_9.x86_64:Collection of performance monitoring toolsforLinux 源 updates 匹配来源 文件名 /usr/bin/sar# 备用查询命令[rootlocalhost ~20:26:59]# yum provides *bin/sar# 安装sar工具对应的软件包[rootlocalhost ~20:27:49]# yum install -y sysstatinstall作用安装软件包# 安装软件包[rootlocalhost ~20:27:52]# yum install -y vsftpd# 只下载不安装将依赖软件包一并下载# 前提是系统中没安装对应软件包才会下载[rootlocalhost ~20:30:12]# yum install vsftpd --downloadonly --downloaddir/root/[rootlocalhost ~20:34:45]# ls vs*vsftpd-sysvinit-3.0.2-29.el7_9.x86_64.rpmlocalinstall作用安装本地文件系统中软件包# 安装本地文件系统中vsftpd包[rootlocalhost ~20:34:51]# yum localinstall vsftpd-sysvinit-3.0.2-29.el7_9.x86_64.rpmdowngrade作用软件包降级# 降级 vsftpd 版本为 3.0.2-28.el7[rootlocalhost ~20:35:22]# yum downgrade -y vsftpd-3.0.2-28.el7... 正在解决依赖关系 --正在检查事务 ---软件包 vsftpd.x86_64.0.3.0.2-28.el7 将被 降级 ---软件包 vsftpd.x86_64.0.3.0.2-29.el7_9 将被 删除 --解决依赖关系完成 错误软件包vsftpd-sysvinit-3.0.2-29.el7_9.x86_64(/vsftpd-sysvinit-3.0.2-29.el7_9.x86_64)需要vsftpd3.0.2-29.el7_9 正在删除: vsftpd-3.0.2-29.el7_9.x86_64(updates)vsftpd3.0.2-29.el7_9 降级由: vsftpd-3.0.2-28.el7.x86_64(base)vsftpd3.0.2-28.el7 您可以尝试添加 --skip-broken 选项来解决该问题 您可以尝试执行rpm-Va--nofiles--nodigest# 需要执行如下命令[rootlocalhost ~20:36:01]# yum downgrade -y vsftpd-3.0.2-28.el7 vsftpd-sysvinit-3.0.2-28.el7# 降级的时候要一并降级依赖软件包update作用软件包升级# 升级 vsftpd 版本为 3.0.2-29.el7_9[rootlocalhost ~20:37:35]# yum update vsftpd-3.0.2-29.el7_9# 升级系统中所有软件为最新版本[rootlocalhost ~20:39:56]# yum undateremove作用软件包卸载# 卸载软件包[rootlocalhost ~20:40:16]# yum remove -y vsftpdhistory 子命令list作用查询yum事务历史记录[rootlocalhost ~20:48:28]# yum history list已加载插件fastestmirror ID|命令行|日期和时间|操作|变更数 -------------------------------------------------------------------------------23|update vsftpd-3.0.2-29.e|2026-05-1820:39|Update|222|downgrade-yvsftpd-3.0.|2026-05-1820:37|Downgrade|221|localinstall vsftpd-sysv|2026-05-1820:35|Install|120|installzlib-devel.x86_6|2026-05-1815:58|I, U|219|install-ypcre2-devel|2026-05-1815:58|Install|418|install-ygcc|2026-05-1815:56|I, U|917|installkubectl--nogpgc|2026-05-1815:10|Install|116|historyredo14|2026-05-1813:53|Update|115|downgrade-yvsftpd|2026-05-1813:52|Downgrade|114|install-yvsftpd|2026-05-1813:51|Update|113|update openssh-server-7.|2026-05-1811:30|Update|312|downgrade openssh-server|2026-05-1811:29|Downgrade|311|downgrade-yvsftpd|2026-05-1811:26|Downgrade|110|update vsftpd|2026-05-1811:26|Update|19|install-yvsftpd-3.0.2-|2026-05-1811:25|Install|18|install-ynet-tools|2026-05-1811:22|Install|17|remove net-tools|2026-05-1811:20|Erase|16|install-ysysstat|2026-05-1811:18|Install|25|install-ywget|2026-05-1810:29|Install|14|install-yyum-utils|2026-05-1810:04|Install|4historylistinfo作用特定yum事务详情[rootlocalhost ~20:48:35]# yum history info 23已加载插件fastestmirror 事务 ID23起始时间 Mon May1820:39:382026启动 RPM 数据库 371:3b8b4f721978a97ce853f372adb041ba96eb282c 结束时间 0 秒 结束 RPM 数据库 371:2f7c1fefb2b493dbfbbf0b0f390e6a8ce325213f 用户 rootroot返回码 成功 命令行 update vsftpd-3.0.2-29.el7_9 事务完成属主 已安装 rpm-4.11.3-48.el7_9.x86_64 anaconda 已安装 yum-3.4.3-168.el7.centos.noarch anaconda 已安装 yum-metadata-parser-1.1.4-10.el7.x86_64 anaconda 已安装 yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch anaconda 已变更的包 更新完毕 vsftpd-3.0.2-28.el7.x86_64 base 更新3.0.2-29.el7_9.x86_64 updates 更新完毕 vsftpd-sysvinit-3.0.2-28.el7.x86_64 base 更新3.0.2-29.el7_9.x86_64 updateshistoryinfoundo作用反向操作第4个事务[rootlocalhost ~20:49:08]# yum history undo 23redo作用重做操作第4个事务[rootlocalhost ~20:49:08]# yum history redo 23
基于 RPM-GPG 的软件完整性验证与 YUM 事务历史管理
Windows 中软件包管理控制面板中程序和功能。通过安装将信息注册到系统中。用户下载的绿色软件。例如U盘启动盘工具rufus。软件包来源应用商城第三方官方网站qq、微信。分析 RPM 包Linux 发行版本以 RHEL 为代表的发行版本使用rpm包管理系统RHEL (Red Hat Enterprise LinuxFedora由原来的RedHat桌面版本发展而来免费版本CentOSRHEL的社区克隆版本免费CentOS StreamRHEL的社区克隆版本免费RockyRHEL的社区克隆版本免费OELOralce Enterprise Linux以 Debian 为代表的发行版本使用deb包管理系统Debian社区Linux的典范迄今为止最遵循GNU规范的Linux系统。UbuntuDebian 衍生版是一个以桌面应用为主的Linux操作系统。Kali LinuxDebian 衍生版旨在渗透测试和数字取证。其他版本ArchLinux Gentoo 等等…RPM 包文件名格式redhat 开发了 rpm 包管理提供一个标准的软件版本管理方法比从归档包解压文件到系统简单多了。CentOS 提供的所有软件都是rpm格式。RPM软件包文件名格式name-version-release.architecture.rpm示例lrzsz-0.12.20-36.el7.x86_64.rpmname是描述其内容的一个或多个词语(lrzsz)。version是原始软件的版本号(0.12.20)。release是基于该版本的发行版号由软件打包商设置后者不一定是原始软件开发商(36.el7)。architecture是编译的软件包运行的处理器架构。noarch表示此软件包不限定架构。x86_64表示此软件包限定x86 64位。aarch64表示此软件包限定ARM 64位。RPM 包组成每个rpm包涵三个部分需要安装的文件。包的元数据信息包括包的名称、版本、架构等软件包说明软件包依赖关系许可证更变日志其他信息。脚本软件包安装更新卸载需要执行的脚本。通常软件提供商使用GPG密钥对RPM软件包进行数字签名Red Hat会对其发布的所有软件包进行数字签名。 RPM系统通过确认包由相应的GPG密钥签名来验证包的完整性。 如果GPG签名不匹配RPM系统拒绝安装包。复习非对称加密非对称加密有一对公钥和私钥。公钥分享给别人用来加密数据。私钥自己保留用来解密公钥加密的数据。Linux中rpm包会被私钥签名客户端使用公钥验证签名确保文件的完整性。RPM 包安装和更新如果同一个软件有多个版本只需安装最高版本。在大多数情况下一个软件只能安装一个版本。 kernel是个例外。如果构建包的文件名没有冲突则可以安装多个版本。 由于只能通过引导到该内核来测试新内核因此特定设计了包以便可以一次安装多个版本。如果内核无法启动则旧内核仍然可用且可引导。软件包升级只需要安装最新版本不需要逐步升级。升级RPM包将删除旧版本的软件包并安装新版本通常会保留配置文件。rpm 命令查询重点基本语法rpm {-q|--query} [select-options] [query-options] select-options [PACKAGE_NAME] [-a,--all] [-f,--file FILE] [-g,--group GROUP] {-p,--package PACKAGE_FILE] [--hdrid SHA1] [--pkgid MD5] [--tid TID] [--querybynumber HDRNUM] [--triggeredby PACKAGE_NAME] [--whatprovides CAPABILITY] [--whatrequires CAPABILITY] query-options [--changelog] [-c,--configfiles] [--conflicts] [-d,--docfiles] [--dump] [--filesbypkg] [-i,--info] [--last] [-l,--list] [--obsoletes] [--provides] [--qf,--queryformat QUERYFMT] [-R,--requires] [--scripts] [-s,--state] [--triggers,--triggerscripts]示例# 查询系统中安装了哪些软件包[rootlocalhost ~16:13:56]# rpm -qavirt-what-1.18-4.el7_9.1.x86_64 grub2-common-2.02-0.87.0.1.el7.centos.9.noarch firewalld-filesystem-0.6.3-13.el7_9.noarch setup-2.8.71-11.el7.noarch sg3_utils-1.37-19.el7.x86_64 basesystem-10.0-7.el7.centos.noarch......# 查询系统中某个软件包是否安装[rootlocalhost ~16:41:59]# rpm -q httpd未安装软件包 httpd[rootlocalhost ~16:42:06]# rpm -q kernelkernel-3.10.0-1160.71.1.el7.x86_64# 查询系统中某个已安装的软件包元数据信息[rootlocalhost ~16:42:16]# rpm -q kernel -iName:kernel Version:3.10.0 Release:1160.71.1.el7 Architecture: x86_64 Install Date:2026年05月13日 星期三19时50分28秒 Group:System Environment/Kernel Size:67412549License:GPLv2 Signature:RSA/SHA256,2022年06月30日 星期四22时25分23秒, Key ID 24c6a8a7f4a80eb5 Source RPM:kernel-3.10.0-1160.71.1.el7.src.rpm Build Date:2022年06月28日 星期二23时55分05秒 Build Host:kbuilder.bsys.centos.org Relocations:(not relocatable)Packager:CentOS BuildSystemhttp://bugs.centos.orgVendor:CentOS URL:http://www.kernel.org/ Summary:The Linux kernel Description:The kernel package contains the Linux kernel(vmlinuz), the core of any Linux operating system. The kernel handles the basic functions of the operating system: memory allocation, process allocation, device input and output, etc.# 查询系统中某个已安装的软件包包涵哪些文件[rootlocalhost ~16:43:50]# rpm -q openssh-server -l/etc/pam.d/sshd /etc/ssh/sshd_config /etc/sysconfig/sshd /usr/lib/systemd/system/sshd-keygen.service /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/sshd.socket /usr/lib/systemd/system/sshd.service /usr/lib64/fipscheck/sshd.hmac /usr/libexec/openssh/sftp-server /usr/sbin/sshd /usr/sbin/sshd-keygen /usr/share/man/man5/moduli.5.gz /usr/share/man/man5/sshd_config.5.gz /usr/share/man/man8/sftp-server.8.gz /usr/share/man/man8/sshd.8.gz /var/empty/sshd# 查询系统中某个已安装的软件包包涵哪些配置文件[rootlocalhost ~16:44:33]# rpm -q openssh-server -c/etc/pam.d/sshd /etc/ssh/sshd_config /etc/sysconfig/sshd# 查询系统中某个已安装的软件包包涵哪些文档文件[rootlocalhost ~16:45:20]# rpm -q openssh-server -d/usr/share/man/man5/moduli.5.gz /usr/share/man/man5/sshd_config.5.gz /usr/share/man/man8/sftp-server.8.gz /usr/share/man/man8/sshd.8.gz# 查询系统中某个某个文件属于哪个已安装的软件包[rootlocalhost ~16:45:36]# rpm -q -f /etc/ssh/sshd_configopenssh-server-7.4p1-23.el7_9.x86_64# 查询系统中某个已安装的软件包包涵的脚本[rootlocalhost ~16:46:05]# rpm -q openssh-server --scriptspreinstall scriptlet(using /bin/sh): getent group sshd/dev/null||groupadd-g74-rsshd||:getentpasswdsshd/dev/null||\useradd-cPrivilege-separated SSH-u74-gsshd\-s/sbin/nologin-r-d/var/empty/sshd sshd2/dev/null||:postinstall scriptlet(using /bin/sh):......# 查询系统中某个已安装的软件包变更日志[rootlocalhost ~16:51:27]# rpm -q openssh-server --changelog* 四7月202023Dmitry Belyavskiydbelyavsredhat.com-7.4p1-23 0.10.3-2 - Avoid remote code executioninssh-agent PKCS#11 supportResolves: CVE-2023-38408 * 四9月302021Dmitry Belyavskiydbelyavsredhat.com-7.4p1-22 0.10.3-2 - avoid segfaultinKerberos cache cleanup(#1999263)- fix CVE-2021-41617(#2008884)......# 下载 httpd 软件包,以及依赖的其他软件包[rootlocalhost ~16:53:12]# yum install -y yum-utils已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本 无须任何处理[rootlocalhost ~16:53:44]# lsanaconda-ks.cfg nginx-1.24.0 nginx-1.24.0.tar.gz[rootlocalhost ~16:53:58]# yumdownloader httpd已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com httpd-2.4.6-99.el7.centos.1.x86_64.rpm|2.7MB 00:00:02[rootlocalhost ~16:54:13]# lsanaconda-ks.cfg httpd-2.4.6-99.el7.centos.1.x86_64.rpm nginx-1.24.0 nginx-1.24.0.tar.gz# 查询系统中某个软件包(package)文件包涵哪些配置文件[rootlocalhost ~16:54:16]# rpm -q -p httpd-2.4.6-99.el7.centos.1.x86_64.rpm -c/etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/userdir.conf /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.modules.d/00-base.conf......# 同样-l -d -i也可以配合-p使用# 查询系统中某个软件包组中包涵哪些软件包[rootlocalhost ~16:55:38]# rpm -qg System Environment/Basegrub2-common-2.02-0.87.0.1.el7.centos.9.noarch centos-release-7-9.2009.1.el7.centos.x86_64 setup-2.8.71-11.el7.noarch......扩展# 查看软件包所在仓库精确位置[rootlocalhost ~17:06:58]# repoquery --location httpdhttp://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/httpd-2.4.6-99.el7.centos.1.x86_64.rpm[rootlocalhost ~17:07:54]# repoquery --location openssh-serverhttp://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/openssh-server-7.4p1-23.el7_9.x86_64.rpm# 此时可以通过 wget 下载特定文件[rootlocalhost ~17:08:05]# wget http://mirrors.aliyun.com/centos/7/updates/x86_64/Packages/httpd-2.4.6-99.el7.centos.1.x86_64.rpm验证基本语法rpm {-V|--verify} [select-options] [verify-options] select-options [PACKAGE_NAME] [-a,--all] [-f,--file FILE] [-g,--group GROUP] {-p,--package PACKAGE_FILE] [--hdrid SHA1] [--pkgid MD5] [--tid TID] [--querybynumber HDRNUM] [--triggeredby PACKAGE_NAME] [--whatprovides CAPABILITY] [--whatrequires CAPABILITY] verify-options [--nodeps] [--nofiles] [--noscripts] [--nodigest] [--nosignature] [--nolinkto] [--nofiledigest] [--nosize] [--nouser] [--nogroup] [--nomtime] [--nomode] [--nordev] [--nocaps] [--noconfig] [--noghost]示例# 查看openssh-server软件安装是否有问题没有提示代表安装没有问题[rootlocalhost ~17:09:32]# rpm -V openssh-server# 修改(change)[rootlocalhost ~17:09:49]# sed -i s/PermitRootLogin yes/PermitRootLogin no/g /etc/ssh/sshd_config[rootlocalhost ~17:22:07]# rpm -V openssh-serverS.5....T. c /etc/ssh/sshd_config[rootlocalhost ~17:22:09]# sed -i s/PermitRootLogin no/PermitRootLogin yes/g /etc/ssh/sshd_config# 移走 /etc/ssh/sshd_config 文件再次查看[rootlocalhost ~17:24:27]# mv /etc/ssh/sshd_config .[rootlocalhost ~17:24:35]# rpm -V openssh-server遗漏 c /etc/ssh/sshd_config# 恢复该文件到原来位置[rootlocalhost ~17:24:38]# mv sshd_config /etc/ssh/[rootlocalhost ~17:24:53]# rpm -V openssh-server.......T. c /etc/ssh/sshd_config安装和卸载基本语法rpm {-i|--install} [install-options] PACKAGE_FILE ... install-options [--allfiles] [--badreloc] [--excludepath OLDPATH] [--excludedocs] [--force] [-h,--hash] [--ignoresize] [--ignorearch] [--ignoreos] [--includedocs] [--justdb] [--nocollections] [--nodeps] [--nodigest] [--nosignature] [--noplugins] [--noorder] [--noscripts] [--notriggers] [--oldpackage] [--percent] [--prefix NEWPATH] [--relocate OLDPATHNEWPATH] [--replacefiles] [--replacepkgs] [--test]示例# 下载软件包[rootlocalhost ~20:09:41]# repoquery --location lrzszhttp://mirrors.aliyun.com/centos/7/os/x86_64/Packages/lrzsz-0.12.20-36.el7.x86_64.rpm[rootlocalhost ~20:10:31]# wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/lrzsz-0.12.20-36.el7.x86_64.rpm--2026-05-1820:10:51-- http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/lrzsz-0.12.20-36.el7.x86_64.rpm 正在解析主机 mirrors.aliyun.com(mirrors.aliyun.com)...36.156.107.55,36.156.3.115,36.156.107.54,... 正在连接 mirrors.aliyun.com(mirrors.aliyun.com)|36.156.107.55|:80... 已连接。 已发出 HTTP 请求正在等待回应...200OK 长度79376(78K)[application/x-rpm]正在保存至: “lrzsz-0.12.20-36.el7.x86_64.rpm”100%[]79,376--.-K/s 用时0.01s2026-05-1820:10:51(6.02MB/s)- 已保存 “lrzsz-0.12.20-36.el7.x86_64.rpm”[79376/79376])# 安装[rootlocalhost ~20:11:00]# rpm -i lrzsz-0.12.20-36.el7.x86_64.rpm软件包 lrzsz-0.12.20-36.el7.x86_64 已经安装[rootlocalhost ~20:11:54]# rpm -q lrzszlrzsz-0.12.20-36.el7.x86_64# 卸载[rootlocalhost ~20:12:03]# rpm -e lrzsz[rootlocalhost ~20:12:46]# rpm -q lrzsz未安装软件包 lrzsz# 友好方式安装[rootlocalhost ~20:12:51]# rpm -ivh lrzsz-0.12.20-36.el7.x86_64.rpm准备中...################################# [100%]正在升级/安装...1:lrzsz-0.12.20-36.el7################################# [100%]# 友好方式卸载[rootlocalhost ~20:13:11]# rpm -evh lrzsz准备中...################################# [100%]正在清理/删除...1:lrzsz-0.12.20-36.el7################################# [100%]# 安装 httpd报错如下下一节讲解如下解决# 安装准备确保系统中没有提供httpd需要的依赖包[rootlocalhost ~20:13:27]# rpm -e apr apr-util httpd-tools mailcap错误未安装软件包 apr 错误未安装软件包 apr-util 错误未安装软件包 httpd-tools 错误未安装软件包 mailcap[rootlocalhost ~20:15:21]# rpm -ivh httpd-2.4.6-99.el7.centos.1.x86_64.rpm错误依赖检测失败 /etc/mime.types 被 httpd-2.4.6-99.el7.centos.1.x86_64 需要 httpd-tools2.4.6-99.el7.centos.1 被 httpd-2.4.6-99.el7.centos.1.x86_64 需要 libapr-1.so.0()(64bit)被 httpd-2.4.6-99.el7.centos.1.x86_64 需要 libaprutil-1.so.0()(64bit)被 httpd-2.4.6-99.el7.centos.1.x86_64 需要重新安装rpm{--reinstall}[install-options]PACKAGE_FILE...示例[rootlocalhost ~20:15:50]# rpm --reinstall -vh lrzsz*准备中...################################# [100%]正在升级/安装...1:lrzsz-0.12.20-36.el7################################# [100%]提取 RPM 包中文件Windows 提取使用压缩工具例如360压缩打开rpm包浏览和提取。Linux 提取了解一步提取所有文件[rootlocalhost ~ 20:16:12]# rpm2cpio httpd-2.4.6-99.el7.centos.1.x# 使用 yum 管理软件包 ## yum 介绍 - rpm 命令是一个管理软件包的工具不适用于软件包存储库或自动解决来自多个源的依赖项。 - YumYellowdog Updater Modified旨在成为管理基于RPM的软件安装和更新的更好系统。yum命令允许安装更新删除和获取有关软件包及其依赖项的信息。 ## yum 命令 ### help 作用 bash # 查看yum命令帮助信息 [rootlocalhost ~ 20:23:46]# yum helpinfo作用查看仓库中某个软件包信息# 查看仓库中httpd包信息[rootlocalhost ~20:24:14]# yum info httpd已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 可安装的软件包 名称 httpd 架构 x86_64 版本 2.4.6 发布 99.el7.centos.1 大小 2.7 M 源 updates/7/x86_64 简介 Apache HTTP Server 网址 http://httpd.apache.org/ 协议 ASL2.0描述 The Apache HTTP Server is a powerful, efficient, and extensible:web server.list作用查询软件包清单# 查看仓库中http开头的包有哪些[rootlocalhost ~20:24:24]# yum list http*已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 可安装的软件包 http-parser.i6862.7.1-9.el7 base http-parser.x86_642.7.1-9.el7......# 查看仓库中httpd包有哪些版本[rootlocalhost ~20:25:26]# yum list httpd --showduplicates已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 可安装的软件包 httpd.x86_642.4.6-95.el7.centos base httpd.x86_642.4.6-97.el7.centos updates httpd.x86_642.4.6-97.el7.centos.1 updates httpd.x86_642.4.6-97.el7.centos.2 updates httpd.x86_642.4.6-97.el7.centos.4 updates httpd.x86_642.4.6-97.el7.centos.5 updates httpd.x86_642.4.6-98.el7.centos.6 updates httpd.x86_642.4.6-98.el7.centos.7 updates httpd.x86_642.4.6-99.el7.centos.1search了解作用根据关键字搜索软件包# 查看简介包含关键字的软件包[rootlocalhost ~20:25:30]# yum search web server# 查看描述和简介包含关键字的软件包[rootlocalhost ~20:26:12]# yum search all web serverprovides作用查看仓库中哪个包可以提供相应文件# 查看仓库中哪个包可以提供文件sar程序[rootlocalhost ~20:26:49]# yum provides sar已加载插件fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com docker-ce-stable/7/x86_64/filelists_db|66kB 00:00:00 mirrors.aliyun.com_kubernetes_yum_repos_kubernetes-el7-x86_64_/filelists|45kB 00:00:00 sysstat-10.1.5-19.el7.x86_64:Collection of performance monitoring toolsforLinux 源 base 匹配来源 文件名 /usr/bin/sar sysstat-10.1.5-20.el7_9.x86_64:Collection of performance monitoring toolsforLinux 源 updates 匹配来源 文件名 /usr/bin/sar sysstat-10.1.5-20.el7_9.x86_64:Collection of performance monitoring toolsforLinux 源 updates 匹配来源 文件名 /usr/bin/sar# 备用查询命令[rootlocalhost ~20:26:59]# yum provides *bin/sar# 安装sar工具对应的软件包[rootlocalhost ~20:27:49]# yum install -y sysstatinstall作用安装软件包# 安装软件包[rootlocalhost ~20:27:52]# yum install -y vsftpd# 只下载不安装将依赖软件包一并下载# 前提是系统中没安装对应软件包才会下载[rootlocalhost ~20:30:12]# yum install vsftpd --downloadonly --downloaddir/root/[rootlocalhost ~20:34:45]# ls vs*vsftpd-sysvinit-3.0.2-29.el7_9.x86_64.rpmlocalinstall作用安装本地文件系统中软件包# 安装本地文件系统中vsftpd包[rootlocalhost ~20:34:51]# yum localinstall vsftpd-sysvinit-3.0.2-29.el7_9.x86_64.rpmdowngrade作用软件包降级# 降级 vsftpd 版本为 3.0.2-28.el7[rootlocalhost ~20:35:22]# yum downgrade -y vsftpd-3.0.2-28.el7... 正在解决依赖关系 --正在检查事务 ---软件包 vsftpd.x86_64.0.3.0.2-28.el7 将被 降级 ---软件包 vsftpd.x86_64.0.3.0.2-29.el7_9 将被 删除 --解决依赖关系完成 错误软件包vsftpd-sysvinit-3.0.2-29.el7_9.x86_64(/vsftpd-sysvinit-3.0.2-29.el7_9.x86_64)需要vsftpd3.0.2-29.el7_9 正在删除: vsftpd-3.0.2-29.el7_9.x86_64(updates)vsftpd3.0.2-29.el7_9 降级由: vsftpd-3.0.2-28.el7.x86_64(base)vsftpd3.0.2-28.el7 您可以尝试添加 --skip-broken 选项来解决该问题 您可以尝试执行rpm-Va--nofiles--nodigest# 需要执行如下命令[rootlocalhost ~20:36:01]# yum downgrade -y vsftpd-3.0.2-28.el7 vsftpd-sysvinit-3.0.2-28.el7# 降级的时候要一并降级依赖软件包update作用软件包升级# 升级 vsftpd 版本为 3.0.2-29.el7_9[rootlocalhost ~20:37:35]# yum update vsftpd-3.0.2-29.el7_9# 升级系统中所有软件为最新版本[rootlocalhost ~20:39:56]# yum undateremove作用软件包卸载# 卸载软件包[rootlocalhost ~20:40:16]# yum remove -y vsftpdhistory 子命令list作用查询yum事务历史记录[rootlocalhost ~20:48:28]# yum history list已加载插件fastestmirror ID|命令行|日期和时间|操作|变更数 -------------------------------------------------------------------------------23|update vsftpd-3.0.2-29.e|2026-05-1820:39|Update|222|downgrade-yvsftpd-3.0.|2026-05-1820:37|Downgrade|221|localinstall vsftpd-sysv|2026-05-1820:35|Install|120|installzlib-devel.x86_6|2026-05-1815:58|I, U|219|install-ypcre2-devel|2026-05-1815:58|Install|418|install-ygcc|2026-05-1815:56|I, U|917|installkubectl--nogpgc|2026-05-1815:10|Install|116|historyredo14|2026-05-1813:53|Update|115|downgrade-yvsftpd|2026-05-1813:52|Downgrade|114|install-yvsftpd|2026-05-1813:51|Update|113|update openssh-server-7.|2026-05-1811:30|Update|312|downgrade openssh-server|2026-05-1811:29|Downgrade|311|downgrade-yvsftpd|2026-05-1811:26|Downgrade|110|update vsftpd|2026-05-1811:26|Update|19|install-yvsftpd-3.0.2-|2026-05-1811:25|Install|18|install-ynet-tools|2026-05-1811:22|Install|17|remove net-tools|2026-05-1811:20|Erase|16|install-ysysstat|2026-05-1811:18|Install|25|install-ywget|2026-05-1810:29|Install|14|install-yyum-utils|2026-05-1810:04|Install|4historylistinfo作用特定yum事务详情[rootlocalhost ~20:48:35]# yum history info 23已加载插件fastestmirror 事务 ID23起始时间 Mon May1820:39:382026启动 RPM 数据库 371:3b8b4f721978a97ce853f372adb041ba96eb282c 结束时间 0 秒 结束 RPM 数据库 371:2f7c1fefb2b493dbfbbf0b0f390e6a8ce325213f 用户 rootroot返回码 成功 命令行 update vsftpd-3.0.2-29.el7_9 事务完成属主 已安装 rpm-4.11.3-48.el7_9.x86_64 anaconda 已安装 yum-3.4.3-168.el7.centos.noarch anaconda 已安装 yum-metadata-parser-1.1.4-10.el7.x86_64 anaconda 已安装 yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch anaconda 已变更的包 更新完毕 vsftpd-3.0.2-28.el7.x86_64 base 更新3.0.2-29.el7_9.x86_64 updates 更新完毕 vsftpd-sysvinit-3.0.2-28.el7.x86_64 base 更新3.0.2-29.el7_9.x86_64 updateshistoryinfoundo作用反向操作第4个事务[rootlocalhost ~20:49:08]# yum history undo 23redo作用重做操作第4个事务[rootlocalhost ~20:49:08]# yum history redo 23