Updating a Package

When you update (upgrade) a package, RPM installs the new version of the software but attempts to leave your existing configuration files intact. You can update a package by using the -U switch of the rpm command:

rpm -Uvh package

When you update a package, RPM automatically uninstalls the old version of the package before installing the new one.

Tip

If no old version of the specified package exists, RPM simply installs the new version. Therefore, you can use the -U switch to install or update a package; many Linux users avoid the -i switch, always using the -U switch instead.

If RPM determines that your existing configuration files may be incompatible with those of the new version of the package, RPM will save a copy of the existing files. In such a case, you need to examine the old and new files and determine what the proper configuration should be. The documentation that accompanies the package should assist you in this process.

If you attempt to update an existing package using an older version of the package, RPM will report an error and terminate without performing the update. To force RPM to perform the update, use the --oldpackage switch:

rpm -Uvh --oldpackage package

Get Learning Red Hat Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.