networkapt

Easy network apt

Quick and dirty way to update any server on your network that uses apt package management.

1. Verify you have ssh key access (passwordless to make this easy)

2. Add to each server you wish to update (security on lan only of course):

"sudo visudo -f /etc/sudoers"

<code>

# This allows any user in the admin group to

# run the apt-automate script without sudoing

%admin ALL= NOPASSWD: /usr/bin/apt-automate

</code>

3. Create a file called apt-automate by issuing the command:

"sudo nano /usr/bin/apt-automate"

<code>

#!/bin/sh

# You may put any other custom flags in apt-get

# here as well

apt-get update && apt-get dist-upgrade

</code>

4. Issue the command to make the script executable

"sudo chmod +x /usr/bin/apt-automate"

5. On the machine you wish to manage the updates from create a file called update_all.sh

"nano ~/update_all.sh"

<code>

#!/bin/sh

# you do not put the local hostname or ip here,

# since the command gets run locally below

hosts="machine1 machine2 machine3"

for i in $hosts;

do

  • echo updating $i please wait....; ssh $i sudo apt-automate; done;

# comment the below line out if you wish to remove

# the local machine from updating

sudo apt-automate

</code>

6. To use, run update_all.sh as a user in the admin group locally.

adopted from http://episteme.arstechnica.com/eve/ubb.x?a=tpc&s=50009562&f=96509133&m=6480986585&r=6480986585#6480986585.


CategoryDocumentation

networkapt (last edited 2008-08-06 16:39:27 by localhost)