Compare the RPM packages installed on two different servers

Setting up new servers can be a pain if you're not able to clone them from a server that is known to be working. Many VPS providers, like Slicehost, allow you to clone a system to a new system. Without that option, you can pull a list of RPM's without their version number for a fairly quick and basic comparison.

First, pull a list of RPM package by name only:

rpm -qa --queryformat='%{NAME}\n' | sort > server.txt

Once you've done that on both servers, just use diff to compare the two files:

diff serverold.txt servernew.txt
Printed from: http://rackerhacker.com/2009/03/10/compare-the-rpm-packages-installed-on-two-different-servers/ .
© Major Hayden 2012.

5 Comments   »

  • Chmouel says:

    I used to use this apps for difference between two rpm packages :

    http://ftp.wl0.org/rpmdiff/rpmdiff

    dunno if it still works

  • Drks000 says:

    Another thing to note is that depending on how much the lists differe.... that diff could be a bit hard to follow. I'd probably opt to do something like:

    for p in $(cat serverold.txt) ; do grep $p servernew.txt >/dev/null || echo $p ; done

    Just getting a flat list of missing packages is the idea (that you could then pass to up2date/yum maybe...

  • I found this very helpful but the output was a bit messy. A quick fix is to only look at the lines which begin with ">".

    diff serverold.txt servernew.txt > diff.txt
    cat diff.txt | grep ">"

    Hope this helps someone!

  • unixfoo says:

    nice tip.

  • Venu says:

    This is really help full...may be some can post you to install missing RPM's in single command:)

RSS feed for comments on this post

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this