--- title: "Installing RStudio on TSD" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{rstudio-tsd-install} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} options(rmarkdown.html_vignette.check_title = FALSE) knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE ) ``` While installing RStudio is not like installing a package, so this package it self cannot help you with that. However, since RStudio has become the most used IDE for R, and is not readily available on TSD, we have compiled here a tutorial on how to get Rstudio working for your TSD project. ## Switching to RHEL7 By default all new TSD linux users are allocated a Virtual Machine (VM) using Redhat 6. Unfortunately, there is just a single, very old RStudio that works on this VM. Contact USIT and request that all users on your project be moved to RHEL7 (you can also do this for insgle users if you dont want to move all). Remember that new users will still be allocated a RHEL6 VM, so when you get new coworkers, make sure they are given the correct VM from the start, or else RStudio will not work for them. ## Get the latest RStudio Go to [Rstudio's webpages](https://rstudio.com/products/rstudio/download/#download) and download the latest **tarball** version availale for Fedora 19/Red Hat 7. Import this file into TSD for install. ```{bash} # Make a folder for common tools for your project, with a subfolder for rstudio mkdir -p /cluster/projects/pXXX/tools/rstudio # Move the rstudio tar mv /tsd/pXXX/data/durable/file-import/pXXX-member-group/rstudio-1.3.1073-x86_64.tar.gz /cluster/projects/pXXX/tools/rstudio # Go to the folder cd /cluster/projects/pXXX/tools/rstudio # Extract the tar-ball tar xvzf rstudio-1.3.1073-x86_64.tar.gz ``` There should now be a folder `/cluster/projects/pXXX/tools/rstudio/rstudio-1.3.1073`. You could theoretically have several versions of RStudio installed on your TSD project simultaneously. In order to help yourself and your users over time, we suggest having the newest version symlinked to `current`, so that when you install a new version, all you need as an administrator is to update the symlink after install, and all users will have their RStudio updated. ```{bash} # Set the new Rstudio to be the current one with a symbolic link ln -s rstudio-1.3.1073 current ``` To confirm the symlink has been made correctly, have a look in the folder using the `-l` option. The symlinked current version will point to which folder it is symlinked to, meaning if you peak inside the `current` folder, you are actually peaking into the `rstudio-1.3.1073` version. ```{bash} ls -l ``` ```{bash} -rwxrwxrwx 1 p32-user staff 4096 Jul 30 09:46 current -> rstudio-1.3.1073 -rwxrwxrwx 1 p32-user staff 4096 Apr 22 09:14 rstudio-1.3.1073 ``` When you install a new version of RStudio after this, you will first need to remove the symlink, before you can make a new one. ```{bash} rm -r current ln -s rstudio-1.3.1100 current ``` ```{bash} ls -l -rwxrwxrwx 1 p32-user staff 4096 Aug 19 12:04 current -> rstudio-1.3.1100 -rwxrwxrwx 1 p32-user staff 4096 Apr 22 09:14 rstudio-1.3.1073 -rwxrwxrwx 1 p32-user staff 4096 Aug 19 10:33 rstudio-1.3.1100 ``` ## create alias to open rstudio. Now that RStudio exists on the system, your users need to be able to open the program from the terminal. To do so, you need to make the RStudio executable file available to them. This means that users need to place one of the following line in their `.bash_profile` to make it available to them ```{bash} # Make an alias alias rstudio=/cluster/projects/pXXX/tools/rstudio/current/bin/rstudio # OR add to the path of executables export PATH=/cluster/projects/pXXX/tools/rstudio/current/bin/:$PATH ``` Saving this in `$HOME/.bash_profile`, restarting a terminal, and now Rstudio should be available by terminal command `rstudio`. If you still cannot make it work with these steps, report an [issue](https://github.com/LCBC-UiO/tsdrtools/issues). If you know of additional needed steps for successful install, either do a direct PR for adding that information to this document, or , report an [issue](https://github.com/LCBC-UiO/tsdrtools/issues). We'd love feedback to improve the instructions!