R/RStudio installation using domain allowlisting on Windows VMs
First version: 2022-08-22
Last version: 2023-12-15
Last change: Added an alternative for installing packages from Github (installation from manually downloaded repository).
This is a community effort. The article was created by the anDREa Support Team in their spare time. If you have found a more efficient way to approach this, please contact us and we will update the article.
For general domain allowlisting setup, please read more here
Certain software might need manual proxy configurations to be set in the software settings, before the software is able to reach domains through a proxy. In this article we describe how to manually configure R/RStudio proxy settings in order to install packages using domain allowlisting.
Step 1: Allowlist domains (see also document about domain allowlists per application here)
Domains needed for packages from CRAN:
- posit.co (new domain for rstudio.com and rstudio.org)
- rstudio.com (some network traffic is still rerouted to the old domain)
- rstudio.org (some network traffic is still rerouted to the old domain)
- OPTIONAL: Any domain of your choice for package repository (e.g. ac.at)
Domains needed for packages from Bioconductor:
Domains needed for packages from Github:
Step 2: Install R and RStudio as an Administrator
Only Accountables, Privileged and Advanced Members are able to install software in administrator mode on VMs (right click R or RStudio, run as admin).
IMPORTANT NOTE: Please note this has been tested with R-4.3.2 and might be different for other R versions.
- You can find the latest version of R and R Studio here: https://posit.co/download/rstudio-desktop/.
- Some organizations have incorporated R and R Studio in their Software Store/Chocolatey. You can contact your local Support Team member to check this if you're not sure whether it is offered.
- If you need to compile packages, then you might also have to install R Tools that matches your R version: https://cran.r-project.org/bin/windows/Rtools/.
- If the domains are open, you can visit the above-mentioned links from within the Workspace and install the preferred versions of R and R Studio.
Step 3: Proxy configurations within R (only required once)
Step 4: Disable setting in RStudio
- Restart RStudio as Administrator.
- In RStudio navigate to Tools > Global Options > Packages and disable Use secure download method for HTTP and click Apply.
Installing packages should work now, if the proper domains are whitelisted.
Step 5: Install packages from CRAN
If you carefully followed the instructions above, you should be able to install packages in R. We strongly advise to install packages in ADMIN mode (right click R or RStudio, run as admin), as this ensures the installed packages are available for any user accessing the Windows VM.
- Find RStudio in the startmenu, right -click > More > click on Run as administrator;
- Install the required packages with:
Be aware that packages may encounter compatibility challenges with specific versions of R/RStudio
If you find that you're still experiencing problems with installing packages, you can also include the line in your code:
Still not working? Add a ticket and ask for assistance of your local the Support Team on support.mydre.org.
Step 6 (optional): Install packages from Bioconductor
- Make sure the proxy settings are correct. Make sure you have the exact same settings as in Step 3.
- Make sure bioconductor.org is allowlisted in your Workspace (as in Step 1).
- Open RStudio as Administrator.
- Install the BiocManager package:
- You can now use BiocManager to install packages through Bioconductor:
Replace [packages] with the name of the package you want to install.
Step 7-A (optional): Install packages from Github
For an unidentified reason, Github is not reliably reachable through proxy, even with the correct proxy settings. You might see some errors such as error in utils or cannot open URL api.github.com. Getting this to work requires a bit more effort.
The method below seems to work for the duration the VM is on Running. If you do find a more efficient way, please let us know and help out the community!
- Submit a ticket to your local Support Team to open up full internet for a short period. Provide at least:
- Workspace name in format dws-xxx-YYY.
- Approval of Accountable. Opening internet access comes with risks.
- Reason for opening up internet: downloading R packages from Github.
- Internet access will be opened up for a short period.
- Upon instruction, go the VM and search for Change Proxy Settings.
- Turn the option Use proxy server off. Notify your local Support Team.
- Internet access will be closed off and communicated.
- Turn the option Use a proxy server back on and click on Save.
- Now make sure the four Github domains are allowlisted in your Workspace (as in Step 1).
- Make sure all the proxy settings are correct like in Step 3.
- Open RStudio as Administrator.
- Install the package devtools:
- Load devtools:
- Install package from a public Github repository:
- Replace [repo] with the Github repository and [package] with the name of the package you want to install.
- If you want to install an R package from a private Github repository, you will need to append the authorisation token to the command above.
Step 7-B (optional): Install packages from Github from a local directory
This is an alternative to Step 7-A above. Since open access to the internet carries a lot of risk, this alternative might be preferable since it does not require internet access.
- If the Github domains have already been allowlisted as described above, navigate to the desired Github repository through a webbrowser in your Virtual Machine. If you did not and do not want to allowlist Github, you can also do this following step in another environment outside the Virtual Machine (e.g. the computer you are working from).
- Click on the green '<> Code' button and select Download ZIP to download the repository in a .zip archive.
- If you downloaded the repository from outside the VM, you can now upload the zip-archive to your workspace like you would usually upload your data.
- Next unzip the archive. The location where you unzip does not matter too much here.
- Open RStudio as Adminstrator and install the package:
- install.packages("C:/path to folder with the package", repos = NULL, type = "source")
R and RStudio using External Access rules
For instruction on using R and RStudio using domain allowlisting (i.e., internet access based on domain instead of IP), see R/RStudio installation using domain allowlisting. R is an open-source programming language often used by researchers and data ...
Prerequisites DRE: Owner access to workspace, to install R / RStudio / Rtools in a virtual machine External access to CRAN in the workspace where you want to export the data to (open up port rule) External access to Castor in the workspace where you ...
Windows-OSDS/1.0.0 Open Source Data Science
Windows-OSDS/1.0.0 Open Source Data Science VM template This template has been discontinued, it is not up-to-date anymore. Please contact your local Support Team member for institute-specific VM templates. OS Windows Server 2019 Web browsers Chrome ...
MATLAB / MathWorks installation and activation
Introduction This article links to knowledge base of MathWorks on how to install their products using network license and on offline machines. See also: myDRE and Software Licenses If you have a working step-by-step procedure for yourself, please ...
Domains to be whitelisted/allowlisted for known applications
First version: 2022-11-01 Last updated: 2024-02-19 Last change: CBS Opendata instructions for using OData 4-protocol. Introduction This is a community effort, if you experience issues, see mistakes/updates, or have other applications that you do know ...