What is the best way to compare the OS configuration of two (or more) RHEL 5.X servers? Are there any tools/packages available to do this? Note, I am mostly looking for tunables OS (kernel parameters, etc).

I would like to add the reason why we are looking to do this:

  1. We have a large zLinux footprint and would like to compare our 'standard build' to that of a distro provided by a vendor. zLinux is somewhat a specialized architecture and often has different recommended settings than that of x86_64.

  2. If we have a highly available cluster of servers, to compare/ensure that the OS configurations are consistent between them.

Note: I'm not looking for a centralized solution like puppet or chef. I agree these are the optimal solutions are definitely on the roadmap, but not what I'm looking for right now :)

  • I would like to add the reason why we are looking to do this: – Patrick Jul 12 '11 at 13:43

It's not completely comprehensive, but rpm can provide a good start. You can get the list of installed packages:

rpm -qa > pkgs.txt

Using standard UNIX tools such as wc and cmp, you can tell which packages are / are not on the two machines.

After that, you can use the --verify option to see if any of the configuration files are different:

rpm --verify cat pkgs.txt

See the rpm man page for information on the information reported by the --verify flag.

|improve this answer|||||
  • Thanks for your answer! We are not worried so much about packages (although that is certainly important), we are more concerned with the tunables in this specialized environment. – Patrick Jul 12 '11 at 13:55

The best way is a centralized solution because "the OS configuration" doesn't exist. Linux doesn't know a registry so the config is spread all over the file system. That makes it pretty hard to do what you want.

That said, you can simply copy the directory /etc of all servers into one place and then compare them with diff -uNr

That should give you 90% of the config but you will also get lots of false negatives.

|improve this answer|||||
  • I agree. Centralized is the best solution. But, in this case, we do have a 'standard build' so we do have something to compare. – Patrick Jul 12 '11 at 13:53

Mount the OS root partitions in /mnt/osA and /mnt/osB

diff -rq /mnt/osA /mnt/osB would give you some output similar to Solaris' lucompare

You could then diff the more concerning files closely, like sysctl.conf, httpd.conf, etc.

And how could I forget Blueprint! With Blueprint you can run against a system and get a recipe of what has changed from the default install.

|improve this answer|||||
  • Didn't know Blueprint, pretty interesting thing. Will try it out in a near future – Anarko_Bizounours Jul 12 '11 at 15:05

Unless your programs and tools adhere to the suggested directory layout and all configuration ends up in /etc, then there is no easy way to "diff" your OS installs.

|improve this answer|||||
  • We are not worried so much about programs, just a vanilla OS install. – Patrick Jul 12 '11 at 13:56

sysctl may be your friend. Something along the lines of:

for host in foo.example.com bar.example.com ; do
  ssh root@$host sysctl -a > $host.conf

And then you diff. :)

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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