Originally published August 21, 2016 @ 10:08 am

I just built a new CentOS box and needed to make sure it had all the same packages installed as one of my other servers. So, before this gets lost in the shell history, here’s some quick syntax. To make your life easier, I suggest you temporarily set up passwordless root SSH. Also, make sure you have the same repos configured on both boxes.

comm -23 <(ssh -qtT ${model_server} "rpm -qa --queryformat='%{N}.%{arch}\n' | sort -f") <(rpm -qa --queryformat='%{N}.%{arch}\n' | sort -f) > ${f}
yum -y install $(cat ${f}) 2>/dev/null