Skip to content

Sonatype Nexus Repository#

Advanced

This section explains why you would use Posit Package Manager in addition to Nexus Repository, and provides the necessary integration steps.

Why use Package Manager and Nexus Repository?#

Nexus Repository is a general-purpose manager that supports multiple languages. If you already have Nexus Repository, or your IT organization has standardized on Nexus Repository, there are benefits to combining it with Package Manager: it can help manage binaries and build artifacts coming from upstream sources.

Do I need Nexus Repository if I only have Package Manager?

No, Package Manager is a complete solution for data science teams using R and/or Python.

Why should I consider Package Manager if I already have Nexus Repository?

Nexus Repository provides basic support for packages, but unfortunately, most data science teams face additional challenges:

  • Version Management: While Nexus Repository provides access to CRAN and PyPI packages, most data scientists are familiar with the challenges that come with managing package versions over time. Package Manager makes this process easier by versioning the repository in addition to versioning individual packages, making it possible for old code to "just work."
  • Approved Subsets of CRAN: Nexus Repository proxies all of CRAN and PyPI. Often, organizations require restricted access to approved subsets of these sources. Package Manager uses knowledge of package dependencies to help organizations maintain these validated subsets.
  • Linux Binaries: Package Manager provides access to pre-compiled R package binaries that make package installation fast enough to prevent disruptions and make it drastically easier to implement automation.

Luckily, teams do not have to pick between the IT-supported Nexus Repository and the benefits of Package Manager -- the two tools can be combined together.

This integration is especially helpful for organizations that wish to have Package Manager offline and can use Nexus Repository as a pass-through proxy for online package sources.

Note

In the Package Manager and Nexus Repository integration, Package Manager still configures CRAN, Bioconductor, and PyPI repositories, not Nexus Repository. Package Manager downloads packages through the Nexus Repository proxy, rather than the Posit Package Service directly.

How to use Package Manager with Nexus Repository#

Nexus Repository and Posit Flowchart

Integrating Package Manager and Nexus Repository#

The goal of these steps is to enable Package Manager to pull CRAN and Python packages and metadata from Nexus Repository.

  1. Navigate to your Nexus Repository instance and log in as an admin.

  2. Click “Server administration and configuration” at the top of the page.

  3. Click “Repositories” on the left-hand side, and then click “Create repository.”

  4. On the “Select Recipe” page, click the “raw (proxy)” option.

  5. Inside the “Create Repository” view, enter package-manager-sync as the unique identifier

  6. For the “Remote storage” option enter:

    https://rspm-sync.rstudio.com
    

    Screenshot in Nexus Repository showing the settings needed to create the Package Manager repository

  7. Under "Use the Nexus Repository truststore," click "View Certificate," and then "add certificate to truststore."

    Screenshot in Nexus Repository showing how to add the Package Manager certificate to the trust store

  8. Under "Storage", clear the "Strict Content Type Validation" check box.

    Screenshot in Nexus Repository showing the settings in Storage

  9. Click "Create Repository" and copy the URL presented.

    Screenshot in Nexus Repository showing the URL for the created Package Manager repository

  10. SSH into the server where Package Manager is installed. Run the following command to ensure that the service is stopped:

    $ sudo systemctl stop rstudio-pm
    
  11. Edit the configuration file to add the following configuration section:

    /etc/rstudio-pm/rstudio-pm.gcfg
    [Manifest]
    URL = "[COPIED URL FROM NEXUS REPOSITORY]"
    
  12. Run the following command to restart the service:

    $ sudo systemctl start rstudio-pm
    
  13. Follow the Quick Start section of this admin guide to create and sync a CRAN, Bioconductor, or PyPI repository.

  14. To verify the integration is complete, navigate to the Activity page in your instance of Posit Package Manager. You will see a repository with an Activity Log showing the addition of CRAN, Bioconductor, or PyPI packages.

    Success

    Screenshot showing successful Activity Log in Posit Package Manager

    Additionally, in /var/log/rstudio/rstudio-pm/rstudio-pm.log, you will notice that Package Manager has been pointed to the Nexus URL.

    In Nexus Repository, you will find evidence that packages have been pulled through it, along with the time at which Package Manager pulled the latest cache sync.

Note

Users will access packages from Package Manager instead of accessing them directly from Nexus Repository.