In my college lab all computers are connected with LAN,so i want to install 'spyder' software from one computer to all computer.
Is it possible ?
3 Answers
For this, my preferred solution is Ansible (https://www.ansible.com/). It let's you automate any kind of configuration or installation across as many computers as you could possibly want. Another upside to Ansible is the community which has already made a lot of robust scripts available, for performing most configuration and installation tasks.
This looks like a fairly comprehensible tutorial to get you up and running with Ansible.
However, if this is just a one-off command you want to run on multiple computers, you're better off just scripting it in Bash.
If it is just a couple of simple commands you need to execute and you don't want to configure complex automation software (like ansible, salt or puppet) you could use clusterssh
.
Open a command line window to install
sudo apt-get install clusterssh
now you can open a connection to a number of hosts, like this
clusterssh -l username labhost1 labhost2 labhost3
clusterssh will then give you a window to enter your commands, but also one terminal window for each host you connect to - so you can see what actually happens!
In this example, you can see the command window with "apt-get update" to the right and all the cluster terminals to the left.
Should one of the hosts have an issue, you can see the error message immediately and click on the corresponding terminal to remedy the situation.
You can also write a list for clusterssh
to connect to:
Open your favorite editor and write to $HOME/.clusterssh/clusters
collegelab labhost1
collegelab labhost2
collegelab labhost3
then connect with
clusterssh -l username collegelab
Further reading
-
In fairness, you could probably do the same from Ansible commandline as simply and easily as you suggest for clusterssh.. :) Put your hosts in an inventory file, and then run the command from terminal, something like
ansible inventory -a 'shell command goes here'
– tpliveJan 28, 2019 at 11:40 -
1@tplive sure, you can do that with ssh commands alone as well, there is also
pssh
.... but with clusterssh you have immediate feedback and a way to stop/remedy if there is an issue. This is just an alternative way to go about things. Personally I'd prefer a software automation (like ansible). Jan 28, 2019 at 11:44 -
In my college lab, each computer have same user name and same password. so can i use
clusterssh
oransible
for that ? Jan 28, 2019 at 11:55 -
-
1@AbhishekKamal Absolutely! For the smoothest experience with password-less login, put your public ssh key into the authorized_keys file on each computer using
ssh-copy-id
or similar.– tpliveJan 28, 2019 at 12:01
Here is a very basic sequential solution assuming you know all the hostnames or ip addresses of the computers on the network and you have enabled public key authentication. See here for more details - https://man.openbsd.org/ssh-keygen.1
- Create a new file e.g.
hosts.txt
- Populate each line of said file with the ip addresses or hostnames of the boxes on your LAN
- Iterate over each line in the file and install the software on the host like so
for i in `cat hosts.txt`; do ssh $i apt-get --assume-yes install spyder; echo ; done
-
@bunnydrug The hostname for all computers in my LAB is CSLAB and password is E201. so what should i write in
hosts.txt
file Jan 30, 2019 at 2:12
Ubuntu
in each computer of my college lab with same username (CSLAB) and same passwrod (E201) and all the computers are connected with the same LAN. So how can i become a administrator for each computer users ?