RStudio Server

From Gruff Goat Wiki
Jump to: navigation, search

Prior to doing any package work, always run

 apt-get update


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


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 trusty/ >> /etc/apt/sources.list
 sudo apt-key adv --keyserver --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
 sudo gdebi rstudio-server-0.99.441-amd64.deb
 sudo rstudio-server verify-installation

RStudio is now available via its special port 8787 on Next step is to set up an NGINX reverse proxy.



 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


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

Add a user to login and use RStudio


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("")
 R> biocLite("rhdf5")
 R> install.packages("httpuv")
 R> install.packages("sqldf")

Favorite Utility Ports

  • lsof
  • mc
  • screen