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
Copy the file
/opt/rstudio-pm/bin/rspm-offline-downloaderto an online Linux server. If you would prefer to use a Windows server or desktop as your online machine, contact firstname.lastname@example.org.
Run the command
rspm-offline-downloader get-cran --helpto 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.
If you enable binaries in offline environments, the size of the download will be larger depending on the number of R versions and Linux distributions selected.
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/...
--include-binaries flag is used, additional directories will be created depending on the
selected R versions and Linux distributions. For example, if the command is
rspm-offline-downloader get-cran ... --include-binaries --r-versions=3.4,3.5 --linux-distros=bionic,centos7 then you should expect
the following directories to be included:
/path/to/destination/bin/3.4-bionic /path/to/destination/bin/3.5-bionic /path/to/destination/bin/3.4-centos7 /path/to/destination/bin/3.5-centos7
Enabling binaries in offline environments is optional. See section 18 for more information on serving binaries.
- Create a directory in the offline RStudio Package Manager server. If you have a cluster of nodes, use shared storage for this directory.
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
rstudio-pm by default:
sudo chown -R rstudio-pm /var/lib/rstudio-pm/cran
- 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
; /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
; /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.
- Follow the remainder of the instructions in the admin guide for setting up
sources and repositories using the
rspmcommands in the offline RStudio Package Manager server. The
rspm synccommand 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 15 for more information.
If you have maintained the originally downloaded files, you can perform a relatively fast update by re-running the
rspm-offline-downloadercommand. Subsequent command executions will simply add or update files as necessary without re-downloading the entire set.
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,
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:
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.
Follow the instructions for the Initial Setup of an Air-Gapped server in E.1, using the offline staging server.
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.
Upgrade the offline production server to the new version of RStudio Package Manager.
(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.
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
> Performing full download of schema version v3.
You can safely remove all of the other folders in the directory. In this example,
/var/lib/rstudio-pm/v3 is necessary.