jupyterhub_rstudio_install/install_v2.sh

28 lines
918 B
Bash

#!/bin/bash
set -euo pipefail
# --- Update & Upgrade machine ---
apt update
apt upgrade -y
# --- Install prerequisites ---
apt install -y python3 python3-dev git curl gdebi-core \
software-properties-common dirmngr gnupg apt-transport-https \
libssl-dev libcurl4-openssl-dev libxml2-dev
# --- Install R (from Ubuntu repos, CRAN packages available) ---
apt install -y r-base
# --- Install RStudio Server (Jammy build works on Noble) ---
RSTUDIO_DEB="rstudio-server-latest-amd64.deb"
curl -LO https://download2.rstudio.org/server/jammy/amd64/${RSTUDIO_DEB}
gdebi -n ${RSTUDIO_DEB}
rm -f ${RSTUDIO_DEB}
# --- Install JupyterHub (The Littlest JupyterHub) ---
curl -L https://tljh.jupyter.org/bootstrap.py | sudo -E python3 - --admin anon
# --- Add R kernel to Jupyter ---
R -e "install.packages('IRkernel', repos='http://cran.r-project.org')"
R -e "IRkernel::installspec(user = FALSE)"