6 Admin CLI

RStudio Package Manager is administered through a command-line interface (CLI). Administrators can use the CLI to create repositories and sources, add local packages to sources, and setup sync schedules for CRAN sources.

The CLI is installed at /opt/rstudio-pm/bin/rspm. The CLI uses the configuration defined in /etc/rstudio-pm/rstudio-pm.gcfg unless you specify an alternate configuration file with the --config flag.

6.1 Privileges

Users must be a member of the rstudio-pm group in order to use the RStudio Package Manager CLI. See C for instructions on changing the required group.

The RStudio Package Manager CLI uses a Unix domain socket for communicating with the RStudio Package Manager server. By default, the domain socket file is located at /var/run/rstudio-pm/rstudio-pm.sock. You can customize the location by configuring the Server.SockFileDir setting.

Any user invoking the RStudio Package Manager CLI must have read/write access to the Unix domain socket in order to communicate with the RStudio Package Manager server.

6.2 Location

The CLI is located at /opt/rstudio-pm/bin/rspm. We recommend that users make an alias, add this location to their PATH, or navigate to this directory if they will be running multiple commands in one session, for example:

alias rspm='/opt/rstudio-pm/bin/rspm'

6.3 Getting Help

Simply run rspm without any arguments to display the top-level help for the RStudio Package Manager CLI. For help with a specific command, you can use the help command. For example, to display help about the create command, you can use rspm help create.

6.4 Example

Here, we provide an example of configuring a new RStudio Package Manager to serve CRAN packages and local packages. See 15 for additional examples and scenarios.

We will create a CRAN source and a local source. Then we will schedule and sync the CRAN source and add internal packages to the local source. Finally, we will create a repository that subscribes to both sources. For more information on sources and repositories, refer to 7.

Throughout the example we will use the alias rspm, see 6.2.

6.4.1 Step 1: Create a local source

rspm create source --name=companyPkgs

Add the internal package parcel_0.1.tar.gz:

rspm add --source=companyPkgs --path=/path/to/parcel_0.1.tar.gz

6.4.2 Step 2: Sync with CRAN

To force an immediate sync with CRAN:

rspm sync

6.4.3 Step 3: Create a repository

rspm create repo --name=companyRepo

Subscribe the repo to the local source and to CRAN:

rspm subscribe --repo=companyRepo --source=companyPkgs
rspm subscribe --repo=companyRepo --source=cran

6.4.4 Step 4: Verify that everything is correct:

rspm list sources
rspm list repos
rspm list sources --repo=companyRepo
rspm list packages --repo=companyRepo --search=parcel

Once setup, the repository will be available from the web UI and users will be able to install both CRAN and local packages.

6.4.5 Optional: Delete a local package

Normally, upgrading a package automatically archives the previous versions. If you ever want to completely remove a package, use the remove command:

rspm remove --source=companyPkgs --name=parcel@0.1 --comment="accidentally included DB credentials"

Note: Removing a package makes the package invisible going forward. It does not delete historical transactions for the package.