模拟安装 RPM 包可以帮助你在实际安装之前检查依赖关系、冲突和其他潜在问题,而不会对系统进行任何实际的更改。
使用 rpm
命令模拟安装
rpm
提供了 --test
选项,可以在不实际修改系统的情况下测试安装过程。这个选项会显示所有检测到的问题(如依赖性问题或文件冲突),但不会对系统做出任何实际更改。
用法:
sudo rpm -ivh --test example.rpm
-i
:表示安装。-v
:显示详细信息。-h
:显示进度条。--test
:仅测试安装,不实际执行安装操作。
实例
提前发现了冲突!
[root@localhost test]# rpm -ivh --test sysstat-11.7.3-13.0.1.an8.x86_64.rpm
Verifying... ################################# [100%]
准备中... ################################# [100%]
file /usr/bin/cifsiostat from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64
file /usr/bin/iostat from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64
file /usr/bin/mpstat from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64
file /usr/bin/pidstat from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64
file /usr/bin/sadf from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64
file /usr/bin/sar from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64
file /usr/bin/tapestat from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64
file /usr/lib64/sa/sa1 from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64
file /usr/lib64/sa/sadc from install of sysstat-11.7.3-13.0.1.an8.x86_64 conflicts with file from package sysstat-11.7.3-11.0.1.an8.x86_64