RStudio Server

From Gruff Goat Wiki
Jump to: navigation, search


Prior to doing any package work, always run

 apt-get update

Purpose

The RStudio Server is intended to act as a simple R Studio console for my personal universal access to R.

Ubuntu

Version initially installed is 14.02LTS. Installed as a t1.micro instance into us-east-1b. Use my standard keyfile. Log in via SSH.

Add swap memory to micro

 sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
 sudo /sbin/mkswap /var/swap.1
 sudo /sbin/swapon /var/swap.1
 sudo cat "/var/swap.1 swap swap defaults 0 0" >> /etc/fstab

Some standard installed packages

 sudo apt-get install htop
 sudo apt-get install aptitude
 sudo apt-get install mc
 sudo apt-get install git


RStudio Server

Add RStudio repository to list.

 sudo cat deb http://cran.case.edu/bin/linux/ubuntu trusty/ >> /etc/apt/sources.list
 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9

Install R and RStudio

 sudo apt-get install r-base
 sudo apt-get install r-base-dev
 sudo apt-get install gdebi-core
 wget http://download2.rstudio.org/rstudio-server-0.99.441-amd64.deb
 sudo gdebi rstudio-server-0.99.441-amd64.deb
 sudo rstudio-server verify-installation

RStudio is now available via its special port 8787 on http://ec2-54-82-53-95.compute-1.amazonaws.com/. Next step is to set up an NGINX reverse proxy.

NGINX

NGINX

 sudo apt-get install nginx

NGINX information.

 sudo service nginx {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}
 sudo touch /etc/nginx/sites-available/rstudio
 sudo ln -s /etc/nginx/sites-available/rstudio /etc/nginx/sites-enabled/
 sudo nano /etc/nginx/sites-available/rstudio

Insert

 server {
   listen 80;
   location / {
       proxy_pass http://localhost:8787;
       proxy_redirect http://localhost:8787/ $scheme://$host/;
   }
 }


Add a user to login and use RStudio

 adduser



Add Packages to R

Mostly this is done as root user from the R command line but sometimes it is necessary to use apt-get from the CLI.

 sudo apt-get install libcurl4-gnutls-dev
 R> install.packages("RCurl")
 
 sudo apt-get install liblzma-dev
 sudo apt-get install default-jdk
 R> install.packages("rJava")
 R> install.packages("xlxs")
 R> install.packages("XLConnect")
 
 sudo apt-get install libxml2-dev
 R> install.packages("XML")
 
 R> install.packages("jsonlite")
 
 sudo apt-get install r-cran-data.table
 ## R> install.packages("data.table")  ## Could try this instead
 
 sudo apt-get install libmysqlclient-dev
 R> install.packages("RMySQL")
 
 R> source("http://bioconductor.org/biocLite.R")
 R> biocLite("rhdf5")
 
 R> install.packages("httpuv")
 
 R> install.packages("sqldf")

Favorite Utility Ports

  • lsof
  • mc
  • screen



References