38 lines
1.2 KiB
Bash
38 lines
1.2 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# --- Update & Upgrade ---
|
|
apt update
|
|
apt upgrade -y
|
|
|
|
# --- Prereqs ---
|
|
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
|
|
|
|
# --- R (Ubuntu repo or switch to CRAN later if you want newer) ---
|
|
apt install -y r-base
|
|
|
|
# --- RStudio Server (Jammy build works on Noble) ---
|
|
ARCH=amd64
|
|
DIST=jammy
|
|
VER=2025.09.0-387
|
|
BASE_URL="https://download2.rstudio.org/server/${DIST}/${ARCH}"
|
|
DEB="rstudio-server-${VER}-${ARCH}.deb"
|
|
|
|
curl -fL -o "${DEB}" "${BASE_URL}/${DEB}"
|
|
|
|
# sanity check: fail if the downloaded file is suspiciously small (<50MB)
|
|
[ $(stat -c%s "${DEB}") -gt $((50*1024*1024)) ] || { echo "Download looks wrong (file too small)"; exit 1; }
|
|
|
|
gdebi -n "${DEB}"
|
|
rm -f "${DEB}"
|
|
|
|
# --- The Littlest JupyterHub ---
|
|
curl -L https://tljh.jupyter.org/bootstrap.py | sudo -E python3 - --admin anon
|
|
|
|
# --- Add R to Jupyter (IRkernel) ---
|
|
R -e "install.packages('IRkernel', repos='https://cloud.r-project.org')"
|
|
R -e "IRkernel::installspec(user = FALSE)"
|
|
|
|
echo "Done. RStudio Server: http://<server-ip>:8787 (login with a system user)" |