Lab 1: Installation

By the end of this lab, you will be able to:

  • Install R so Package Manager can build packages
  • Install and license Posit Package Manager
  • Create and subscribe a CRAN and a PyPI repository
  • Verify the installation from both the command line and the web interface
NoteBefore You Begin

This lab puts into practice the concepts covered in Installation Overview. If you have not read it yet, review it first so the steps below make sense.

Install R

Package Manager requires R to build internal packages. You will use this version of R to build a package from Git later in this course.

Use the instructions in the documentation to install the latest version of R version.

NoteWhat is the latest version of R?

The Posit Install R documents are usually up to date, but should be checked against the CRAN Release Notes to make sure you are providing end-users the latest version of R.

The first line in this script specifies which version of R to install.

Terminal
export R_VERSION=4.6.0
curl -O https://cdn.posit.co/r/ubuntu-2404/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb
sudo apt-get update
sudo apt-get install ./r-${R_VERSION}_1_$(dpkg --print-architecture).deb

The installers that Posit provides for R, put the files required in /opt and allow you to install multiple versions side-by-side. You can check that R is correctly installed by running:

/opt/R/4.6.0/bin/R --version

which should produce the following output:

R version 4.6.0 (2026-04-24) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

Install Posit Package Manager

To install Package Manager, follow the instructions in the documentation for Installing Posit Package Manager.

Posit distributes Package Manager through Linux repositories (Ubuntu, RHEL, and SLES/openSUSE), so the installation process is similar to installing any other Linux package.

For Ubuntu, the installation process is as follows:

Terminal
curl -1sLf \
  'https://dl.posit.co/public/pro/setup.deb.sh' \
  | sudo -E bash

sudo apt-get install rstudio-pm=2026.04.2
sudo apt-mark hold rstudio-pm

Note that you install a specific version and use apt-mark hold (or the equivalent command for your Linux distribution) to prevent the package from being automatically updated during a routine system maintenance process. This is a best practice for all Posit products, as it gives you control over when updates occur in your environment, allowing you to test newer versions of the product in a staging environment before rolling them out to production.

Activate the Package Manager License

Using the instructions listed in the documentation, activate your installation of Package Manager using the license file found in your home directory.

To activate your license, you can use the following command, substituting the path to your license file found in your home directory.

Terminal
sudo chown rstudio-pm <license-file>.lic
sudo chmod 0600 <license-file>.lic
sudo cp -a <license-file>.lic /var/lib/rstudio-pm/
sudo systemctl restart rstudio-pm

To determine the current license status, use the following command:

Terminal
sudo /opt/rstudio-pm/bin/license-manager status

As you are using a license file, only the output under -- License file status -- is relevant to you. You should see that the license has Status: Activated, and there are some days left under Days-Left.

After restarting Package Manager, check that it is running as expected by checking the output of:

Terminal
sudo systemctl status rstudio-pm.service

Configure Package Manager Repositories

Package Manager installs with no repositories defined by default. Use the Quick Start documentation to configure a CRAN and a PyPI repository.

Terminal
## For CRAN
sudo rspm create repo --name=cran --description='CRAN packages'
sudo rspm subscribe --repo=cran --source=cran

## For PyPI
sudo rspm create repo --name=pypi --type=python --description='Access PyPI packages'
sudo rspm subscribe --repo=pypi --source=pypi

Then run sudo rspm list to verify that they have been correctly created and configured. Your output should look something like this:

Terminal
2 repos (unlimited)

cran - CRAN packages - R
 - cran (CRAN)
pypi - Access PyPI packages - Python
 - pypi (PyPI)
No Subscriptions
 - bioconductor (Bioconductor)
 - openvsx (Open VSX)

Verify Your Work

Navigate to the web interface of your Package Manager installation by clicking on the tab at the top, and verify that the two repositories you created have loaded correctly and that you can see packages populated in the interface.

Screenshot of the Package Manager web interface listing the cran and pypi repositories with their package counts.

Screenshot of the Package Manager web interface showing the cran and pypi repositories

A Few Configuration Tips

  • To avoid having to prefix sudo to every rspm command, you can add your user (in this lab ubuntu) to the rstudio-pm group with the following command:
Terminal
sudo usermod -aG rstudio-pm ubuntu
  • Restart your shell (in Instruqt, this can be done by clicking on the refresh arrow in the top right corner of the terminal window).
  • Confirm that the group ownership for your user is correct by typing groups in the terminal and checking that rstudio-pm is listed.
  • Run rspm list without sudo to confirm that you can run rspm commands without sudo and see the same output as before.
  • Package Manager needs a language runtime installed to build packages; the R you install in this lab is the same R that builds internal packages from Git later in the course.
  • License file activation is recommended because it needs no external activation service, which suits the air-gapped and firewalled environments where Package Manager is common.
  • A fresh installation defines no repositories: you make packages available by creating repositories and subscribing them to sources such as CRAN and PyPI.
  • Pin the installed version and apt-mark hold it so routine system maintenance cannot upgrade Package Manager without your control.
  • Know the key paths: configuration lives in /etc/rstudio-pm/rstudio-pm.gcfg, the rspm CLI in /opt/rstudio-pm/bin/, and the data directory /var/lib/rstudio-pm/ is what you back up.