Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells

Using YUM to Sync Packages with Master Server

Submitted by on August 21, 2016 – 10:40 pm

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

 

Print Friendly, PDF & Email

Leave a Reply