1

I have to install standard package like java 1.7 in 40 of my lab machines which are connected over a LAN.

I know I can simply write a shell script to install something in user space of each system, that basically does an scp to each system and extracts them to user space, but how can I install packages from one sytem to another that requires root access to each system?

And yes I have root access to each of the system, but I don't know how to automate the installation over the network by controlling from a single system.

1 Answer 1

1

first you need to automate login using ssh keys then write a script to run the install command in a loop You will also need to use one system which will be able to login to all other systems

First cd to your home directory to create ssh keys

cd
mkdir -p .ssh
cd .ssh

create keys and copy them to all other systems

ssh-keygen 

copy the public key to remote machines

ssh-copy-id -i ~/.ssh/id_rsa.pub root@remotesys1
ssh-copy-id -i ~/.ssh/id_rsa.pub root@remotesys2
...
ssh-copy-id -i ~/.ssh/id_rsa.pub root@remotesys40

if you don't have DNS for remotesys1 then you can use IP

create a file with all the system name or IP in a file systems.txt

remotesys1
remotesys2
..
remotesys40

run the below script and change "./install.sh" to whatever you install command is

for system in $(cat systems.txt ) ; do echo $system ; ssh $system "./install.sh" ; done
1
  • you can improve on Abey's answer by using cssh instead
    – hiandbaii
    Oct 31, 2014 at 16:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .