Using YUM to Sync Packages with Master Server
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. If you need to set up your own web server click here for more info. 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.
f=/tmp/missing_packages.txt model_server=server_name 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; done