8.7 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 option 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.

If no old version of the specified package exists, RPM simply installs the new version. Therefore, you can use the -U option to install or update a package; many Linux users avoid the -i (install) option, always using the -U option instead. However, you should not use the -U option when installing a package containing an updated Linux kernel.

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 that 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 option:

rpm -Uvh --oldpackage  package