Skip to content

Instantly share code, notes, and snippets.

@daler
Created September 7, 2017 18:11
Show Gist options
  • Save daler/8b6fbf45d2e0336b6d544ce6d407e925 to your computer and use it in GitHub Desktop.
Save daler/8b6fbf45d2e0336b6d544ce6d407e925 to your computer and use it in GitHub Desktop.

On an m4.10xlarge:

sudo apt-get install imagemagick xorg libx11-dev libglu1-mesa-dev htop

Then fire up R as root, and run the following (note that biocLite nowadays will install from CRAN which is pretty nice!)

source("https://bioconductor.org/biocLite.R")
biocLite(
c(
  "DESeq2",
  "flowQ",
  "flowUtils",
  "RchyOptimyx",
  "flowViz",
  "genefilter",
  "GenomicFeatures",
  "Rsamtools",
  "AnnotationDbi",
  "org.Hs.eg.db",
  "GenomicAlignments",
  "GenomicFeatures",
  "pheatmap",
  "RColorBrewer",
  "ks",
  "BiocParallel",
  "Gviz",
  "sva"
  )
)

Add users

newusers kept segfaulting on me when providing a large file, so this is one user per file, overwritten each time.

Contents of addusers.py:

#!/usr/bin/env python
import os
for i in range(1, 60):
    with open('tmp', 'w') as fout:
        fout.write('user{0}:xzfy:100{1}:100{1}:,,,:/home/user{0}:/bin/bash\n'.format(i, i+10))
    os.system('newusers tmp')

Run with sudo python addusers.py

Shared R libs

sudo mkdir -p /opt/RLIBS
sudo rsync -r /home/ubuntu/R/x86_64-pc-linux-gnu-library/3.4/ /opt/RLIBS/
sudo chmod -R ugo+r /opt/RLIBS

If you need to install anything else, do it as ubuntu user as root and re-run the last two lines.

Edit rstudio config

Edit /etc/rstudio/rsession.conf to add the line:

r-libs-user=/opt/RLIBS/

Then restart RStudio Server

sudo rstudio-server restart

Get data into users' directories

Clone the repo into ubuntu's home dir, then send out to users. Note it's 89MB, so copying it all to 60 users may not be efficient

git clone https://github.com/burkesquires/immunology-informatics.git
#!/usr/bin/env python
import os
for i in range(60):
    os.system('rsync -rv immunology-informatics /home/user{0}/immunology-informatics'.format(i)
    os.system('chown -R user{0}:user{0} /home/user{0}/immunology-informatics'.format(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment