Configuration

In R on Linux, packages are downloaded from CRAN as source packages. The default CRAN mirror is https://cloud.r-project.org. The default repository URL needs to be actively changed to one providing binaries for the respective Linux distribution. This can be done either for all users of the system, on a project level or for specific users only. All options will be shown in the following.

URL Scheme

The URL scheme for this project is the same for all operating systems and only differs in the OS and architecture identifiers.

URL scheme

https://cran.devxy.io/<architecture>/<os>/latest

For example, the URL for Alpine Linux 3.21 for arm64 would be https://cran.devxy.io/arm64/alpine321/latest.

The architecture identifiers are:

  • arm64
  • amd64

The OS identifiers are:

  • jammy (Ubuntu 22.04)
  • noble (Ubuntu 24.04)
  • rhel8 (RedHat Enterprise Linux 8)
  • rhel9 (RedHat Enterprise Linux 9)
  • alpine320 (Alpine Linux 3.20)
  • alpine321 (Alpine Linux 3.21)

Repository Configuration

System-wide

To configure the default R repository for all users of a system, create/edit $R_HOME/etc/Rprofile.site. The location of this file depends on how R has been installed. To find its location, execute R -q -e "paste0(Sys.getenv('R_HOME'),'/etc/Rprofile.site')".

At the bottom of the file, add the following:

options(repos = structure(c(CRAN = "<URL>")))

The name “CRAN” is optional. It is the canonical default and in some cases also used for special actions (e.g. in Posit Workbench and {pak}). Unless you have a good reason, it is advisable to stick with that name.

User-wide

To change the default repository option for a specific user, add the line from above to ~/.Rprofile.

Project-wide

To change the default repository option for a specific project, add the line from above to .Rprofile in the project root directory in which R is started.

Verification

When starting R, execute getOption("repos") to verify the repository is correctly configured.

Back to top