‘R’ Studio Server Instance + Shiny Server

Most Researchers in Australia who work at an Australian university or at one of a number of Federal agencies have automatic membership with the Australian Access Federation (AAF). This gives automatic access to some services where AAF access is a pre-requisite. National eResearch Collaboration Tools and Resources (NeCTAR) currently operates a compute cloud where AAF members have access to 2 CPU cores and 8GB or RAM, with the option to request additional resources.

TPAC has created a virtual machine image to allow R users a simple but powerful way to use R in a robust  visualized environment. This page outlines the process of running your own server with the R command line tools, plus the R Studio Server web based interface in the NeCTAR Cloud.

This document will be slightly technical, users with some computing knowledge should be fine. If you would like assistance please contact TPAC. It is assumed that you already have some experience with using the NeCTAR compute cloud.

 

Step 1. Access the NeCTAR Research Compute Cloud:

http://dashboard.rc.nectar.org.au/

You should be familiar with the compute cloud, and have the ability to deploy instances and be able to login to them. To learn more about the cloud and what it’s all about visit http://support.rc.nectar.org.au/docs/about-research-cloud

 

Step 2. Deploy a TPAC R Studio Server:

Launch the TPAC R Studio Server image. It will be labelled something like:

TPAC RX.X Studio Server – – – – – – – – –

This instance has the following installed:

When launching the instance you need to ensure you have done the following:

  • Created a key pair for SSH access, you will need this.
  • Allow Port 22 for SSH and SFTP access.
  • Create a security group and allow Port 8787 for access to the web interface.
  • OPTIONAL (If you would also like to use shiny server, then also add port 3838 as well).

 

Step 3. Creating a user for accessing R Studio Server. (CONSOLE)

R Studio Server uses local accounts for access, so in order to use the web interface you first must create a local account. This can be done by using SSH to login to the machine using the key you created as part of the deployment process.

Logging in can be done a number of ways, here is a basic example using the command line from a Mac:

ssh ubuntu@THE_IP_OF_THE_INSTANCE -i /THE_KEY_I_CREATED_AND_DOWNLOADED.pem

Once you are logged in you can create a new user with the adduser command.

sudo adduser USERNAME

Follow the prompts, provide a password and some additional details and the account will be created.

NOTE: make sure you pick a secure password, mix upper and lower case + Numbers.

 

Step 4. Login to the instance using the web interface.

You should now be able to login to the R Studio web interface, from a web browser go to:

http://THE_IP_OF_THE_INSTANCE:8787

At the prompt login using the USERNAME and password created above.

You should now be logged into the R Studio interface, and have the ability to use R.

 

Removing users:

You should remove users that no longer require access to the web interface, from the console (SSH):

sudo userdel USERNAME

 

Changing a users password:

Password for users can be changed using the following command from the console (SSH)

sudo passwd USERNAME 

 

Shiny Server:

Shiny Server (http://www.rstudio.com/shiny/) is also installed as part of the base image, if you have opened the port (3838) as mentioned above it will be able to access it via:
 
http://THE_IP_OF_THE_INSTANCE:3838

 

Other Considerations:

  • You can create more than one user if more than one person requires access.
  • If you need additional space or have multiple users use the /mnt folder in the system to store data, as it’s much bigger than the root file system. (NOTE this is not snapshot-able from the NeCTAR dashboard).
  • Add new R packages with install.packages(‘NAME’) by running R as “sudo R” from the command line (SSH), not R Studio server web interface. This will make them globally available to all users (new and existing).
  • Once your instance is running you will be responsible for it’s use and you should keep it up to date. You should at a minimum be doing the following to keep the system and R up to date:
    System:
    sudo apt-get update && sudo apt-get upgrade
    R Studio:
    “sudo R”, then run “update.packages()”
  • Consider restricting the access to the machine (ports 22 and 8787) to a restricted IP range.
  • If you don’t need it any longer, then delete the instance, it’s easy to setup a new one, as you already have the security rules and keys.