Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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
    echo ""
    echo "logging into $host2 $where"
    echo ""
    sleep 1
    rsh $host2
    echo ""
    echo "Preparing to install $package on $host2"
    sudo yum -y install $package
    if ($host2 == $this_machine) then 
    goto decrement
    goto decrement

    @ numlines--

share|improve this question

migrated from Jan 22 '13 at 12:16

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

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( or xargs.
  5. If you liked the automation look into tools for automated administration like puppet(wikipedia).
share|improve this answer

You must log in to answer this question.