E Air-Gapped RStudio Package Manager

RStudio Package Manager communicates with a RStudio CRAN service to access CRAN packages and metadata. In offline environments, it is possible to directly download the necessary data from the RStudio CRAN service and then copy it to an offline RStudio Package Manager server.

This guide includes 3 sections:

  • Instructions for an initial air-gapped setup (E.1)
  • Instructions for performing regular updates (E.2)
  • Instructions for upgrading RStudio Package Manager in an air-gapped environment (E.3)

E.1 Initial Setup

  1. Copy the file /opt/rstudio-pm/bin/rspm-offline-downloader to an online Linux server. If you would prefer to use a Windows server or desktop as your online machine, contact support@rstudio.com.

  2. Run the command rspm-offline-downloader get-cran --help to learn about the available options. When ready, you can run the command with the appropriate flags to perform the full download.

These steps will download metadata, README files and package archives which total more than 50 GB of data and may take some time to complete.

The result will be a directory with files prefixed by a version indicator, e.g.

/path/to/destination/v3/version.txt
/path/to/destination/v3/1
/path/to/destination/v3/1/...
  1. Create a directory in the offline RStudio Package Manager server. If you have a cluster of nodes, use shared storage for this directory.
mkdir /var/lib/rstudio-pm/cran

Copy the data downloaded in step 2 from the online machine to the directory on the offline RStudio Package Manager server. For completely isolated servers, you may need to copy the data to a physical drive in order to move it to the offline environment.

Confirm by checking that the offline directory has the same number of files as the original directory on the online machine.

Finally, modify the permissions on the directory in the offline RStudio Package Manager server, changing ownership to the unix account running RStudio Package Manager, rstudio-pm by default:

sudo chown -R rstudio-pm /var/lib/rstudio-pm/cran
  1. Next, configure the offline RStudio Package Manager server to use the downloaded data. To do so, modify the RStudio Package Manager Configuration file to include the following properties in the CRAN configuration section:
; /etc/rstudio-pm/rstudio-pm.gcfg

[CRAN]
ManifestURL = A URL in the form, `file:///<the directory you created in step 3>`

For example, if your CRAN data directory is at /var/lib/rstudio-pm/cran, the file /etc/rstudio-pm/rstudio-pm.gcfg should contain:

; /etc/rstudio-pm/rstudio-pm.gcfg

[CRAN]
ManifestURL = file:///var/lib/rstudio-pm/cran

Once the file is updated, restart the RStudio Package Manager Service.

  1. Follow the remainder of the instructions in the admin guide for setting up sources and repositories using the rspm commands in the offline RStudio Package Manager server. The rspm sync command will use the downloaded data to populate the necessary CRAN data and packages.

E.2 Regular Updates

It is important to regularly update data available on the offline server. Updating this data does not automatically make new packages available to end users. The following process pushes updates from the RStudio CRAN service to RStudio Package Manager’s metadata. Follow the instructions in the admin guide to make updates available to end users. See chapter 14 for more information.

  1. If you have maintained the originally downloaded files, you can perform a relatively fast update by re-running the rspm-offline-downloader command. Subsequent command executions will simply add or update files as necessary without re-downloading the entire set.

  2. Copy the directory from the online machine to the folder created in the offline RStudio Package Manager during the initial setup, e.g. /var/lib/rstudio-pm/cran. Ensure that the directory is still owned by the unix account running RStudio Package Manager, rstudio-pm by default.

E.3 Upgrading RStudio Package Manager

A new version of RStudio Package Manager may require data from a new version of the RStudio CRAN service. To ensure a smooth upgrade with limited downtime, we recommend the following steps:

  1. You will need a staging environment that mirrors your offline production server. After creating this environment, begin by upgrading the offline staging server to the latest RStudio Package Manager release.

  2. Follow the instructions for the Initial Setup of an Air-Gapped server in E.1, using the offline staging server.

  3. After you have validated that everything works as expected, copy the the CRAN data, e.g. /var/lib/rstudio-pm/cran, from the offline staging server to the offline production server.

  4. Upgrade the offline production server to the new version of RStudio Package Manager.

  5. (Optional) After an upgrade, navigate to the directory storing CRAN data, e.g. /var/lib/rstudio-pm/cran. This directory will contain versioned folders, e.g.

/v2
/v3

The output from rspm-offline-downloader get-cran will have indicated the version of the RStudio CRAN service required by the current version of RStudio Package Manager, e.g. > Performing full download of schema version v3.

You can safely remove all of the other folders in the directory. In this example, only /var/lib/rstudio-pm/v3 is necessary.