Update Multiple Linux Servers Simultaneously From Windows

linux-penguin

Unlike Windows, Linux can be extremely flexible. Have you ever updated multiple Windows servers. It is a daunting task, even when using an automated approach like WSUS or whatever it is called these days. Linux is easier, however, to log into server, and run a simple command can become time-consuming if there are many servers. I have written a script that can be run from within Windows to update all the Linux servers that your Windows box can access.

In order to get this little script to work, you will need to install PuTTY. Specifically for the command-line interface known as Plink. Create a batch file with the following four lines. The second line are the IP addresses for each of your Linux servers. The third line, uses plink, with yourpassword, and root access (or some account similar).

The following code is adapted on and tested on CentOS 5.8.

@echo off
set ip_linux=(10.10.10.10 10.10.10.11 10.10.10.12 10.10.10.13 10.10.10.33)
for %%i in %ip_linux% do start plink -C -v -pw YOURPASSWORD root@%%i /usr/bin/yum -y update
goto eof

After introducing a couple of Ubuntu servers to the environment, the code has been modified to include these Ubuntu servers. Note, however, that the Ubuntu servers have been modified to allow for root access via SSH.

@echo off
set ip_centos=(10.10.10.10 10.10.10.11 10.10.10.12 10.10.10.13 10.10.10.14)
set ip_ubuntu=(10.10.10.20 10.10.10.21)

for %%i in %ip_centos% do start plink -C -v -pw YOURPASSWORD root@%%i /usr/bin/yum -y update
for %%i in %ip_ubuntu% do start plink -C -v -pw YOURPASSWORD root@%%i apt-get update; sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

goto eof

Source(s)
http://askubuntu.com/questions/146921/how-do-i-apt-get-y-dist-upgrade-without-a-grub-config-prompt