Install example-2.0-1.x86_64.rpm.
Replace an older installed version, or install it if no version is installed.
Which command is appropriate?
rpm -U performs an upgrade: it replaces an older version when present and installs the package when it is not yet installed. This differs from -F.
Detailed explanation
rpm -Uvh example-2.0-1.x86_64.rpmCorrect. rpm -Uvh installs the archive and upgrades an older installed version when present.
Correct. rpm -Uvh installs the archive and upgrades an older installed version when present.
rpm -Fvh example-2.0-1.x86_64.rpmIncorrect. -F freshens only packages that are already installed.
Incorrect. -F freshens only packages that are already installed.
rpm -e example-2.0-1.x86_64.rpmIncorrect. -e erases an installed package and expects a package name.
Incorrect. -e erases an installed package and expects a package name.
rpm -V example-2.0-1.x86_64.rpmIncorrect. -V verifies installed files rather than installing an archive.
Incorrect. -V verifies installed files rather than installing an archive.
Try it yourself
An example you can run in a temporary verification environment.
rpm --help | grep -E -- '--upgrade|-U'Expected result
upgrade操作の説明。実際の導入は行わないKey points
- -U upgrades or installs
- The argument is an RPM file
- -F only updates installed packages
Notes
- Environment: RPM 4.19〜6.x公式仕様
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.