Skip to content

Instantly share code, notes, and snippets.

@wch
Created August 1, 2012 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wch/3229976 to your computer and use it in GitHub Desktop.
Save wch/3229976 to your computer and use it in GitHub Desktop.
EC2 setup for R
# x-large high-cpu - set up
ec2-run-instances ami-82fa58eb --region us-east-1 --instance-type c1.xlarge --key ec2-keypair-us-east-1 --user-data-file bootstrap.sh
# Get IP address:
ec2-describe-instances --region us-east-1
# Wait for a bit, then run:
./setup.sh ec2-23-20-74-242.compute-1.amazonaws.com a_vagrant_machine/ ~/.ec2/ec2-keypair-us-east-1
# Connect
ssh -i ~/.ec2/ec2-keypair-us-east-1 ubuntu@ec2-23-20-74-242.compute-1.amazonaws.com
# Fix temp dir - put it on ephemeral storage, which is at /mnt
# NOTE: /mnt/tmp must be created after every reboot!
sudo -s
mkdir /mnt/tmp
chmod uga+rwxt /mnt/tmp
mv /tmp /oldtmp
ln -s /mnt/tmp /tmp
# Make temp dir for user
mkdir /mnt/user
chown ubuntu:ubuntu /mnt/user
# Install vncserver - needed for x11 libs, which are needed for R packages like cairoDevice
apt-get install -y vnc4server
# Install curl dev libraries
apt-get install -y libcurl4-openssl-dev
# Install xt-dev (for Cairo)
apt-get install -y libxt-dev
# Install gtk dev libraries (for cairoDevice - doesn't work?)
apt-get install -y gtk+2.0-dev
# Install java (for rJava)
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java7-installer
update-java-alternatives -s java-7-oracle
R CMD javareconf
# Install cmake and qt (for qtbase)
apt-get install -y cmake qt4-dev-tools
# Install xml (for XML)
apt-get install -y libxml2-dev
# Install libgeos (for rgeos)
apt-get install -y libgeos-dev
# Install gdal and libproj (for rgdal)
apt-get install -y libgdal1-dev libproj-dev
# Install qpdf
apt-get install -y qpdf
# ========= NOT as root =========
# R testing (not as root)
R
install.packages('devtools')
# Install winston's customized version of devtools
library(devtools)
install_github('devtools','wch','parallel-check-cran')
# Quit R
quit(save='no')
# Get ggplot2
cd /mnt/user
git clone git://github.com/hadley/ggplot2.git
# Restart R and install ggplot2
R
library(devtools)
dev_mode()
# Install gtable
install_github('gtable')
# Install local ggplot2 (will prompt to install dependencies)
install('ggplot2')
# Check ggplot dependencies
# This needs to be done in a vnc session, started with:
vncserver :1
system.time(revdep_check('ggplot2', threads=8, libpath='~/R-crancheck'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment