This is an example Lmod module that sets up the environment necessary to launch RStudio Server. It assumes a Singularity module already exists or that it is installed on the machine.
Lmod modules are typically used at most high-performance computing (HPC) centers.
-
Modify the
modulefiles/x.y.z.lua
to your specification. -
Download the corresponding Singularity image under
x.y.z/singularity-rstudio.simg
:$ mkdir x.y.z $ cd x.y.z $ singularity pull --name singularity-rstudio.simg shub://nickjer/singularity-rstudio:x.y.z $ cd ..
The downloaded Singularity image nickjer/singularity-rstudio is entirely optional. You are welcome to create and maintain your own images using the above image as an example.
Users may request that you install R packages. I am not entirely sure if
installed packages work across major (x
) or minor (x.y
) version numbers. So
to err on the side of caution I treat packages separate within minor versions
of R (feel free to inform me otherwise).
-
Create a library for the corresponding R minor version if one doesn't already exist:
$ mkdir library-x.y
-
Confirm you have permissions to write to this directory.
-
Confirm the corresponding module files
modulesfiles/x.y.z.lua
point to this library. -
Load any one of the corresponding module files and launch R:
$ module load rstudio_singularity/x.y.z $ R
-
Install requested packages:
install.packages("my_package", lib="/library")
and be sure it is writing to the path
/library
.
Although it should be noted that users can install their own R packages under
the R_LIBS_USER
directory specified in the module file.
-
Load any one of the corresponding module files and launch R:
$ module load rstudio_singularity/x.y.z $ R
-
Install requested packages:
install.packages("my_package")