Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We've rebuilt a bunch of RPMs because we wanted to remove modules and change config options for items specific to our production environment. We're hosting them in a private repo, and have them signed with our own GPG key and have our company name appended to the package name.

TO save ourselves a step after installing the package, I'd like to replace the base config file with config files that are specific to our environment. I'm not very familiar with adding things to spec files. What's the easiest way to do this? Package file?

share|improve this question
up vote 3 down vote accepted

If the file you're replacing is already named in the specfile (i.e. you're really replacing it) then you need only replace the file during your build (typically done with a patch to the original source, but you could always replace the file in the original source archive, too). If you're adding a file, then you'll want to add the file to the "%files" section of the specfile.

I'd recommend having a look at the Packaging software with RPM series from IBM. It's very good, and will give you a lot of useful background on the subject.

share|improve this answer
I replaced the file in the original archive, but I think there's something somewhere in the make process that overwrites it or edits it. The original file is named <packagename> -- if I replace that file, tar everything back up, and place that in the SOURCES dir, then it still doesn't make it into the final build. There is one line -- %{__install} -Dp -m0644 src/collectd.conf %{buildroot}%{_sysconfdir}/collectd.conf -- could I replace that with a different source and have it come out included? – Karl Katzke Oct 21 '10 at 17:58
@Karl Katzke: The build process creates the src/collectd.conf from src/ You could include your tweaked-up configuration file in the package and modify the line referenced above, or create a package that contains only your configuration file and install it after the fact. Having to roll out a new package for the entire program because you altered your configuration would stop me from including the configuration file in the package. I'd create a package with just the configuration file in it, personally. – Evan Anderson Oct 21 '10 at 18:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.