Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have a small network of 15 users. I need to install some new libraries using yum on all computers on the network. I already have a csh script which allows me rsh onto all computers on the system so I could manually switch to root and install the required dependencies for each rsh. Is there a more effective means of doing this?

I have tried to do this using the following csh script. I have continued to use rsh for the moment while testing. However the script dies as soon as I rsh to another host file. What am I doing wrong?

if ($1 == "")then
    echo -n "Please enter a package to install\n"
    set package=$<
else set package = $#argv
endif

set numlines = `cat $NM_HOME/sh_local/nc_network2.txt | grep -v "^#" | fgrep "%" |  wc -l`
while ($numlines>0)
    set line = `cat $NM_HOME/sh_local/nc_network2.txt | grep -v "^#" | fgrep "%" | tail -$numlines | head -1`
    set host2 = `echo $line | cut -f 1 -d %`
    set where = `echo $line | cut -f 2 -d %`
    if ($host2 == $this_machine) then 
    echo "This is $host2....skipping rsh to this machine"
    echo ""
    goto yum
    endif
    echo ""
    echo "logging into $host2 $where"
    echo ""
    sleep 1
    rsh $host2
    yum:
    echo ""
    echo "Preparing to install $package on $host2"
    sudo yum -y install $package
    if ($host2 == $this_machine) then 
    goto decrement
    else
    logout
    goto decrement
    endif

    decrement:
    @ numlines--

end
share|improve this question

migrated from stackoverflow.com Jan 22 '13 at 12:16

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 2 down vote accepted
  1. Use ssh with public-key authentication to avoid typing passwords and to keep some sort of security.
  2. Log in directly as root or run sudo yum.
  3. Make sure yum is run noninteractively as yum -y so that the installation can run unattended.
  4. Have a list of hosts in a file and run the installation in parallel on all hosts using GNU parallel(gnu.org) or xargs.
  5. If you liked the automation look into tools for automated administration like puppet(wikipedia).
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.