Skip to content

coregenomics/cgi-updater

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 

Update CGI computers remotely

Updates Ubuntu 14.04 computers with latest version of R, RStudio, R libraries, Python and BioPython, for bioinformatics training.

Remote computer requirements:

  • ClusterShell
  • ssh key authentication for all 10 laptops
  • Wired connection (wireless in the building is flaky)

Usage

Setup your /etc/hosts and map the target laptops as e.g. cgi01, cgi02, etc. The Ubuntu machines don't have openssh-server installed on them, so install it, copy the keys, and then disable password authentication.

# On the laptops
local$ sudo apt-get update && sudo apt-get -y install openssh-server
local$ sudo sed -i 's/#Pass.*/PasswordAuthentication no/' /etc/ssh/sshd_config

Then create an ssh keys and copy it over:

remote$ idf=~/.ssh/id_rsa-cgi-202
remote$ ssh-keygen -f $idf -N ""
remote$ for host in cgi{01..10}; do ssh-copy-id -i $idf cgi_user@$host; done

Add the identity file to your ~/.ssh/config

Host cgi*
     IdentityFile ~/.ssh/id_rsa-cgi-202
     User cgi_user	  

Test that the keys work with:

remote$ alias clush="clush -B -w cgi[01-10]"
remote$ type clush # verify alias
remote$ clush id -u
1000

On each computer, locally restart SSH server for the disabled password authentication to take effect.

local$ sudo service ssh restart

Running sudo remotely is a pain, so use the same key for remote root access.

local$ sudo mkdir -p /root/.ssh
local$ sudo sh -c "echo $(tail -1 ~/.ssh/authorized_keys) >> /root/.ssh/authorized_keys"
local$ sudo cat /root/.ssh/authorized_keys

In the present configuration, commands are normally executed as cgi_user. To execute as root, use the -l root option of clush:

remote$ clush -l root id -u
0
remote$ clush -l root --copy cgi-updater-payload.sh --dest /root/
remote$ clush -l root ls /root/
# Remove the `-B` flag to stream output to troubleshoot problems
remote$ alias clush="clush -w cgi[01-10]"
remote$ clush -l root ./cgi-updater-payload.sh

Finishing up

Verify R and biopython versions:

remote$ clush -B "R --version | awk 'NR == 1 {print \$3}'"
remote$ clush -B "pip show biopython | awk '/Version/ {print \$2}'"
remote$ clush -B dpkg-query --showformat='\${Version}' --show rstudio

About

R and Python system updater script for CGI room 202 computers

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages