Update install_v2.sh

This commit is contained in:
RomanNum3ral 2025-09-30 15:46:45 +00:00
parent f9c830767a
commit 3cbac01c59
1 changed files with 24 additions and 13 deletions

View File

@ -1,27 +1,38 @@
#!/bin/bash
set -euo pipefail
# --- Update & Upgrade machine ---
# --- Update & Upgrade ---
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 \
# --- 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
# --- Install R (from Ubuntu repos, CRAN packages available) ---
# --- R (Ubuntu repo or switch to CRAN later if you want newer) ---
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}
# --- 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"
# --- Install JupyterHub (The Littlest JupyterHub) ---
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 kernel to Jupyter ---
R -e "install.packages('IRkernel', repos='http://cran.r-project.org')"
# --- 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)"