diff --git a/jupyterhub_config_https.py b/jupyterhub_config_https.py index 940e715..efed5b4 100644 --- a/jupyterhub_config_https.py +++ b/jupyterhub_config_https.py @@ -1,6 +1,6 @@ c.JupyterHub.bind_url = 'https://:443/' - - +c.JupyterHub.ssl_cert = '/opt/jupyterhub/etc/jupyterhub/ssl-certs/jhubssl.crt' +c.JupyterHub.ssl_key = '/opt/jupyterhub/etc/jupyterhub/ssl-certs/jhubssl.key' # Configuration file for jupyterhub. diff --git a/setup_apps_conda.sh b/setup_apps_conda.sh index e63a3fd..9beb650 100644 --- a/setup_apps_conda.sh +++ b/setup_apps_conda.sh @@ -12,6 +12,15 @@ if [ "$EUID" -ne 0 ] exit fi +CERTIFICATE_HOSTNAME=$1 + +if [ -z "$CERTIFICATE_HOSTNAME" ] +then + echo "Please specify hostname for the certificate generation" + exit +fi + + #apt-get install -y --no-install-recommends libnvinfer7=7.1.3-1+cuda11.0 \ # libnvinfer-dev=7.1.3-1+cuda11.0 \ # libnvinfer-plugin7=7.1.3-1+cuda11.0 @@ -27,9 +36,7 @@ fi #apt-get install -y ipmitool && modprobe ipmi_devintf apt-get update -apt-get install -y language-pack-de - -apt-get install python3.10-venv +apt-get install -y language-pack-de python3.10-venv echo "Install a recent notejs for jupyterhub from nodesource..." #src: https://github.com/nodesource/distributions/blob/master/README.md @@ -53,11 +60,17 @@ cp jupyterhub_conda.service /opt/jupyterhub/etc/systemd/jupyterhub.service ln -s /opt/jupyterhub/etc/systemd/jupyterhub.service /etc/systemd/system/jupyterhub.service systemctl daemon-reload systemctl enable jupyterhub.service -systemctl start jupyterhub.service -echo "jupyterhub.service status:" -systemctl status jupyterhub.service +echo "Generate self signed certificate..." +mkdir -p /opt/jupyterhub/etc/jupyterhub/ssl-certs +openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \ + -keyout /opt/jupyterhub/etc/jupyterhub/ssl-certs/jhubssl.key \ + -out /opt/jupyterhub/etc/jupyterhub/ssl-certs/jhubssl.crt \ + -subj "/C=DE/ST=NRW/L=na/O=na Systems/OU=Self_Signed/CN=$CERTIFICATE_HOSTNAME" \ + -addext "subjectAltName=DNS:$CERTIFICATE_HOSTNAME" +#echo "jupyterhub.service status: (opens vim)" +#systemctl status jupyterhub.service echo "Install anaconda..." #wget -O /tmp/anaconda3.sh https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh @@ -66,7 +79,7 @@ curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > install -o root -g root -m 644 conda.gpg /etc/apt/trusted.gpg.d/ echo "deb [arch=amd64] https://repo.anaconda.com/pkgs/misc/debrepo/conda stable main" | sudo tee /etc/apt/sources.list.d/conda.list apt-get update -apt-get install conda +apt-get install -y conda #symlinking the conda shell setup script to the profile ‘drop in’ folder so that it gets run on login: ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh @@ -74,11 +87,12 @@ ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh mkdir /opt/conda/envs/ /opt/conda/bin/conda create --prefix /opt/conda/envs/python python=3.7 ipykernel -/opt/conda/envs/python/bin/python -m ipykernel install --prefix /usr/local/ --name 'python' --display-name "Python (default)" +#/opt/conda/envs/python/bin/python -m ipykernel install --prefix /usr/local/ --name 'python' --display-name "Python (default)" +/opt/conda/envs/python/bin/python -m ipykernel install --prefix=/opt/jupyterhub/ --name 'python' --display-name "Python (default)" #users have to setup there kernel like this: -#/path/to/kernel/env/bin/python -m ipykernel install --name 'python-my-env' --display-name "Python My Env" +#/opt/conda/envs/python/bin/python -m ipykernel install --name 'python-my-env' --display-name "Python My Env" #conda install --yes jupyterhub jupyterlab notebook configurable-http-proxy jupyterlab-git jupyter-server-proxy @@ -112,6 +126,9 @@ mkdir /opt/conda/envs/ #systemctl disable iscsid.service #systemctl disable open-iscsi.service +echo "Start JupyterHub..." +systemctl start jupyterhub.service + echo "" echo "Setup successfully finished"