Skip to content

Instantly share code, notes, and snippets.

@cderv
Last active May 5, 2022 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cderv/3459eac5bab9a706915bc41f0ac1d8f4 to your computer and use it in GitHub Desktop.
Save cderv/3459eac5bab9a706915bc41f0ac1d8f4 to your computer and use it in GitHub Desktop.
Connect to AZURE VM to test some R stuff

AZURE VM notes

Install azure CLI

Scoop

scoop install azure-cli

Powershell module

https://docs.microsoft.com/en-us/powershell/azure/install-az-ps

Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

WSL

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Connect to Azure

az login
Connect-AzAccount

Connecting to VM

  • Get IP of VM
az vm list-ip-addresses --resource-group <group> --output table

# directly ip address
az vm list-ip-addresses --resource-group <group> | jq '.[].virtualMachine.network.publicIpAddresses[].ipAddress
  • Connect using the generated pem file
ssh -i <pem file> azureuser@<ip>

Install R

# install rim
curl -Ls https://github.com/gaborcsardi/rim/releases/download/v0.2.3/rim-linux-0.2.3.tar.gz |   sudo tar xz -C /usr/local

# install R
rim add 4.1.2
rim default 4.1.2
rim system add-pak

# Install JQ
sudo apt-get install jq

# install rstudio
curl -Ls https://gist.githubusercontent.com/cderv/0b637e0b32af7e0bea1a9ef551735927/raw/9a4fc3ef7beb9c2bec77fd939115a135c7cc89fc/update-rstudio.sh | bash
sudo apt-get --fix-broken install

Run R

  • Run R
options(repos = c(CRAN = "https://packagemanager.rstudio.com/all/__linux__/bionic/latest"))
pak::pak("rmarkdown")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment