Setting Default Repositories#
For R#
In R, default repositories are set using files at the server, R version, user, or project level.
In most RStudio Workbench installations, server admins set a binary RStudio Package Manager repository as the default.
File | Level | Use |
---|---|---|
rsession.conf |
Whole Server | Configuring single repo server-wide |
repos.conf |
Whole Server | Configuring multiple repos-server wide |
Rprofile.site or Renviron.site |
Version of R | Configuring different repos per R version |
rsession.conf#
Adming configuring a single server-wide default repository for
RStudio Workbench, you can use the r-cran-repos
argument to the
`rsession.conf`file. This argument can only take a single repository.
For example, on a Ubuntu Bionic installation of RStudio Workbench, an admin might configure
/etc/rstudio/rsession.conf
r-cran-repos=https://packagemanager.rstudio.com/all/__linux__/bionic/latest
repos.conf#
Admins configuring multiple server-wide default repositories for
RStudio Workbench can use the repos.conf
file.
For example, on a Ubuntu Bionic installation of RStudio Workbench, an admin might configure
/etc/rstudio/repos.conf
CRAN=https://packagemanager.rstudio.com/all/__linux__/bionic/latest
Internal=https://my-package-manager/internal/__linux__/bionic/latest
Rprofile.site#
Admins configuring repositories that are specific to R versions can use
either Rprofile.site
files.
These files are set for each version of R and should be located in
R_HOME/etc/
. You can find R_HOME
by running the command
R.home(component = "home")
in a session of that version of R.
For example, if you find that R_HOME
is /opt/R/3.6.2/lib/R
, the
Rprofile.site
for R 3.6.2 would go in
/opt/R/3.6.2/lib/R/etc/Rprofile.site
.
Rprofile.site
files are sourced as regular R code, so setting the repository might look like
/opt/R/3.6.2/lib/R/etc/Rprofile.site
options(repos = c(CRAN = "https://packagemanager.rstudio.com/all/__linux__/bionic/latest"))"
For Python#
In Python, repositories can be set in a pip.conf
file. These can be set
globally for all versions of Python at /etc/pip.conf
.
To set a repository for a particular Python version, a virtualenv
should be
used, and the repository can be set in $VIRTUAL_ENV/pip.conf
.
The pip.conf
might look like:
/etc/pip.conf
[global]
index-url = https://my-rstudio-package-manager/latest/simple