I have several applications that I wish to deploy using rpm. Some of the files in my application deployments override files from other deployed packages. Simply including the new files in the deployment package will cause rpm conflicts.
I am looking for the proper way to use rpm to update/replace already installed files.
I have already come up with a few solutions but nothing seems quite right.
This seems like a large amount of work for a relatively small reward even though it feels less like a hack than some of the other possible solutions.
This would work but will mean littering the system with multiple copies of the files. Also it means additional maintenance in the rpm build spec for each file.
This is similar to the copy technique but the files wouldn't even live in the rpm. This might act like a nice central configuration authority though.
This is also similar to the copy technique but with less clutter. The problem here is that some files don't behave well as symlinks.
There are two main options of rpm command that are used to install or upgrade RPM packages: -i is used to install a new package. Always use this for kernel installations and upgrades just in case. -U is used to upgrade an RPM package but will also install a package if it does not exist in the RPM database.
Maintaining Software Using RPM (Red Hat Package Manager) RPM is a powerful software manager which can be used to build, install, query, verify, update, and uninstall individual software packages.
However, RPM's freshen option does not install a package if no previously-installed package of the same name exists. This differs from RPM's upgrade option, as an upgrade does install packages whether or not an older version of the package was already installed. Freshening works for single packages or package groups.
To the best of my knowledge, RPM is not designed to permit updating / replacing existing files, so anything that you do is going to be a hack.
Of the options you list, I'd choose #1 as the least bad hack if the target systems are systems that I admin (as you say, it's more work but is the cleanest solution) and a combination of #2 and #4 (symlinks where possible, copies where not) if I'm creating the RPMs for others' systems (to avoid having to distribute a bunch of RPMs, but I'd make it very clear in the docs what I'm doing).
You haven't described which files need to be updated or replaced and how they need to be updated. Depending on the answers to those questions, you may have a couple of other options:
.d
subdirectory. For example, Apache uses /etc/httpd/conf/httpd.conf
and /etc/httpd/conf.d/*.conf
, so your RPMs could drop files under /etc/httpd/conf.d
instead of modifying /etc/httpd/conf/httpd.conf
. And if the files that you need to modify are config files that don't follow this pattern but could be made to, you can suggest to the package maintainers that they add this capability; this wouldn't help you immediately but would make future releases easier.sendmail
and lpr
that can be provided by multiple packages, the alternatives
system (see man alternatives
) permits more than 1 RPM that provides these utilities to be installed side by side. Again, if the files that you need to modify are command-line utilities that don't follow this pattern but could be made to, you can suggest to the package maintainers that they add this capability./opt
just so I wouldn't have to stomp on files installed by other admins' RPMs./opt
, and the Software Collections tools offer a standardized way for users to opt in to using those instead of whatever's normally installed under /usr
. Red Hat uses this to distribute newer versions of tools for their otherwise stable and long-lived (i.e., older) Red Hat Enterprise Linux distributions.You can also execute rpm -U --replacefiles --replacepkgs ...
, which will give you what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With