Upgrading a Package

The most basic version of the rpm -U command is simply "rpm -U", followed by the name of a .rpm package file:
# rpm -U eject-1.2-2.i386.rpm
#
        

Here, RPM performed all the steps necessary to upgrade the eject-1.2-2 package, faster than could have been done by hand. As in RPM's install command, Uniform Resource Locators, or URLs, can also be used to specify the package file. [1]

rpm -U's Dirty Little Secret

Well, in the example above, we didn't tell the whole story. There was no older version of the eject package installed. Yes, it's true — rpm -U works just fine as a replacement for the normal install command rpm -i.

This is another, more concrete example of the strength of RPM's method of performing upgrades. Since RPM's install command is smart enough to handle upgrades, RPM's upgrade command is really just another way to specify an install. Some people never even bother to use RPM's install command; they always use rpm -U. Maybe the "-U" should stand for, "Uh, do the right thing"…

Notes

[1]

For more information on RPM's use of URLs, please see the section called URLs — Another Way to Specify Package Files in Chapter 2.