conda install updated

This commit is contained in:
Nicolas 2022-06-23 09:02:26 +02:00
parent 081487e0e3
commit 324ab0bf97
3 changed files with 1474 additions and 39 deletions

11
jupyterhub_conda.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=JupyterHub
After=syslog.target network.target
[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/jupyterhub/bin"
ExecStart=/opt/jupyterhub/bin/jupyterhub -f /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py
[Install]
WantedBy=multi-user.target

1390
jupyterhub_config_https.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
#variant to use conda insted of pip, not tested
#Src: https://medium.com/swlh/how-to-install-jupyterhub-using-conda-without-runing-as-root-and-make-it-a-service-59b843fead12
# https://jupyterhub.readthedocs.io/en/1.2.1/installation-guide-hard.html
set -e
@ -16,43 +17,80 @@ fi
# libnvinfer-plugin7=7.1.3-1+cuda11.0
#add public ssh keys
if [ ! -s "~/.ssh/authorized_keys" ]; then
cat id_*.pub >> ~/.ssh/authorized_keys
fi
#if [ ! -s "~/.ssh/authorized_keys" ]; then
# cat id_*.pub >> ~/.ssh/authorized_keys
#fi
echo ""
echo "Install supermicro system tools..."
apt-get update
apt-get install -y ipmitool && modprobe ipmi_devintf
#echo ""
#echo "Install supermicro system tools..."
#apt-get update
#apt-get install -y ipmitool && modprobe ipmi_devintf
apt-get install -y language-pack-de
echo "Install a recent notejs for jupyterhub from nodesource..."
#src: https://github.com/nodesource/distributions/blob/master/README.md
curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs npm
echo "create virtualenv and install JupyterHub..."
python3 -m venv /opt/jupyterhub/
/opt/jupyterhub/bin/python3 -m pip install wheel
/opt/jupyterhub/bin/python3 -m pip install jupyterhub jupyterlab
/opt/jupyterhub/bin/python3 -m pip install ipywidgets
npm install -g configurable-http-proxy
echo "setup jupyterhub config..."
mkdir -p /opt/jupyterhub/etc/jupyterhub/
cp jupyterhub_config_https.py /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py
echo "setup systemd service..."
mkdir -p /opt/jupyterhub/etc/systemd
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 "Install a recent notejs for jupyterhub from nodesource..."
#curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
#apt-get install -y nodejs npm
echo "Install anaconda..."
wget -O /tmp/anaconda3.sh https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh
bash /tmp/anaconda3.sh
#wget -O /tmp/anaconda3.sh https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh
#bash /tmp/anaconda3.sh
curl https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | gpg --dearmor > conda.gpg
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
echo "Install JupyterHub..."
apt-get install -y language-pack-de
conda install --yes jupyterhub jupyterlab notebook configurable-http-proxy jupyterlab-git jupyter-server-proxy
#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
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)"
#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"
#conda install --yes jupyterhub jupyterlab notebook configurable-http-proxy jupyterlab-git jupyter-server-proxy
#jupyter labextension install jupyter-matplotlib
echo "Setup JupyterHub..."
mkdir /etc/jupyterhub/
cp jupyterhub_config.py /etc/jupyterhub/jupyterhub_config.py
cp jupyterhub.service /etc/systemd/system/jupyterhub.service
systemctl enable jupyterhub
systemctl start jupyterhub
#echo "Install Tensorflow..."
#conda install --yes tensorflow-gpu
echo "Install Tensorflow..."
conda install --yes tensorflow-gpu
#echo "Install cantera..."
#conda install --yes --channel cantera cantera
echo "Install cantera..."
conda install --yes --channel cantera cantera
#echo "Install common Python libs..."
#conda install --yes h5py tqdm pandas ipywidgets pillow matplotlib ipympl opencv-python
echo "Install common Python libs..."
conda install --yes h5py tqdm pandas ipywidgets pillow matplotlib ipympl opencv-python
#Other tools:
#System monitoring
#echo "Install netdata..."
@ -61,19 +99,15 @@ conda install --yes h5py tqdm pandas ipywidgets pillow matplotlib ipympl opencv-
#service netdata restart
#on http://0.0.0.0:19999
echo "Install gpuview..."
python3 -m pip install gpuview
gpuview service --host 127.0.0.1 --port 9988
#echo "Install gpuview..."
#python3 -m pip install gpuview
#gpuview service --host 127.0.0.1 --port 9988
echo "Disable services that delays startup by wating for network connectivity..."
systemctl disable cloud-config
systemctl disable cloud-final.service
systemctl disable iscsid.service
systemctl disable open-iscsi.service
echo "show gpu state..."
nvidia-smi
#echo "Disable services that delays startup by wating for network connectivity..."
#systemctl disable cloud-config
#systemctl disable cloud-final.service
#systemctl disable iscsid.service
#systemctl disable open-iscsi.service
echo ""
echo "Setup successfully finished"