Skip to content

Integration with Posit Package Manager#

RStudio is now Posit!

Our professional products have been renamed to Posit Connect, Posit Workbench, Posit Package Manager, Posit Cloud, and Posit Academy so it’s easier for folks to understand that we support more than just R. Please review our Blog post/FAQ to answer commonly asked questions about the rebrand.

Posit Package Manager, formerly RStudio Package Manager, is a repository management server product that makes it easy to organize and centralize R packages at your organization. Package Manager may help if your organization needs offline CRAN access, package access restrictions, internal package sharing, or other special package management needs. To learn more, visit the Package Manager Product Page and contact your Posit Customer Success Representative.

Overriding CRAN with Package Manager#

You may wish to redefine CRAN or another R package repository to point to your organization's Package Manager repository, or at some other private R package repository that you have set up.

When a user deploys R content, the content comes with a packrat.lock file, or a manifest.json file that is used to generate the packrat.lock file. This file contains the versions and cryptographic hashes of all the package dependencies for the content, as well as the URLs of the package repositories in the deploying user's environment. CRAN is one such repository, and it is the most commonly used repository for R programming.

You should first obtain the repository link from Package Manager:

  1. Open Package Manager

  2. Select your repository in the Repos list on the left side of the screen

  3. Select Setup in the navigation bar at the top of the screen

  4. Under Repository URL, select whether you want the Latest checkpoint or select a date to Freeze the packages to a particular date.

    Important

    Freezing your repository to a date could lead to users attempting to deploy content containing package versions that did not exist at that date. If that happens, their content will fail to build because it cannot find necessary packages.

  5. If present on your version of Package Manager, select whether you want Source or Binary packages.

    Important

    If you choose binary packages, you must select the distribution that matches the distribution of Linux you are using on Connect.

  6. Under Use this URL... link, copy the URL.

  7. In the /etc/rstudio-connect/rstudio-connect.gcfg configuration file, add the following setting, replacing <the URL you copied> with the URL that you copied in the previous step:

    [RPackageRepository "CRAN"]
    URL = <the URL you copied>
    
  8. Important: You MUST force your packrat cache to rebuild every time you change this setting. You can accomplish this while the server is shut down by running the migrate utility:

    /opt/rstudio-connect/bin/migrate rebuild-packrat --force
    

    Note

    The location of the binary and the command line options you need to pass may vary depending on where your installation is located on the filesystem.

For additional information, please see the Connect Admin Guide - Appendix.