9

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 ?

  • Are you the administrator? If not, get permission first. – Thorbjørn Ravn Andersen Jan 29 at 0:09
  • I installed 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 ? – Abhishek Kamal Jan 29 at 3:48
  • 1
    @AbhishekKamal, a word of advice.. Don't post real usernames (and passwords??) on public websites. And also, if "E201" really is your admin-password, consider replacing it with something a lot more secure! – tplive Jan 29 at 7:35
  • Solutions such as Ansible and clusterssh (mentioned below) use SSH to connect to the computers you want to manage. You can (and should) set up password-less access which affirms trust among the computers (ie your computer is trusted by all managed computers) for automation to work smoothly. – tplive Jan 29 at 7:38
  • 1
    An "administrator" on Ubuntu is nothing more than someone who can become root, e.g. with "sudo -s" (and then run "apt" to install software). Why are you doing this in the first place? – Thorbjørn Ravn Andersen Jan 30 at 13:41
14

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.

13

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!

ClusterSSH example 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' – tplive Jan 28 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). – Robert Riedl Jan 28 at 11:44
  • In my college lab, each computer have same user name and same password. so can i use clusterssh or ansible for that ? – Abhishek Kamal Jan 28 at 11:55
  • @RobertRiedl and that's why I upvoted your answer.. :) – tplive Jan 28 at 11:59
  • 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. – tplive Jan 28 at 12:01
0

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

  1. Create a new file e.g. hosts.txt
  2. Populate each line of said file with the ip addresses or hostnames of the boxes on your LAN
  3. 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 – Abhishek Kamal Jan 30 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.