Skip to main content

Using R in Secure VMs in tiCrypt

· 2 min read
Thomas Samant

R is an indispensable tool for statistical computing and graphics, employed across a wide range of sectors. For users of tiCrypt, managing R in offline virtual machines (VMs) is essential to comply with security protocols while maintaining essential functionality. Here’s how to manage R libraries locally and through NFS mounts.

General Instructions for tiCrypt Users

Operating R in offline mode requires handling libraries and packages locally or from a network file system (NFS) mount when direct internet access is not available.

Installing R Packages Locally:

  1. Download Packages: On an internet-enabled machine, download the R package files (typically .tar.gz files) from CRAN or other repositories.
  2. Transfer to VM: Transfer these downloaded package files to your tiCrypt VM through approved secure methods.
  3. Install Locally: Install the packages from the local files using the following command in R:
    install.packages(path_to_file, repos = NULL, type = "source")
    Replace path_to_file with the path to your downloaded package file.

Installing from an NFS Mount:

If a CRAN repository is mirrored on an NFS accessible to your VM, you can install packages directly from there, bypassing the need for local file transfers:

  1. Set Library Location: Specify the library location to your NFS mount where the CRAN mirror resides:
    Replace path_to_cran_mirror with the actual NFS mount path to the CRAN repository.
  2. Install Packages: Install the R packages using the following command:
    install.packages("[PACKAGE_NAME]", repos=NULL, type="source")
    Replace [PACKAGE_NAME] with the actual name of the R package you want to install.

Specific Guidelines for Citadel Users

In the Citadel environment, RStudio is easily accessible from the applications toolbar, and specific embedded instructions simplify the package installation process:

Installing R Packages in Citadel:

  1. Access R or RStudio: Launch R or RStudio from the applications toolbar.
  2. Set Library Location: Use this command to direct R to the NFS mount where the CRAN repository is mirrored:
  3. Install Packages: Install your desired packages with either of the following commands, depending on whether the global library path has been set:
    install.packages("[PACKAGE_NAME]", repos = NULL, type = "source")
    Or specify the contriburl directly:
    install.packages("[PACKAGE_NAME]", contriburl="file:///mnt/modules/cran2/src/contrib", type = "source")

R Startup Message:

For Citadel users, the R startup message includes instructions on installing packages, ensuring you have the necessary steps readily available.