clean up, adding "set -e"

This commit is contained in:
Nicolas 2022-05-05 10:41:19 +02:00
parent 0d573fce40
commit a46f685ff2
4 changed files with 144 additions and 98 deletions

View File

@ -1,3 +1,8 @@
c.JupyterHub.bind_url = 'http://:8000/deepserv'
# Configuration file for jupyterhub.
#------------------------------------------------------------------------------
@ -141,7 +146,7 @@
# This is the address on which the proxy will bind.
# Sets protocol, ip, base_url
# Default: 'http://:8000'
c.JupyterHub.bind_url = 'http://:8000/deepserv'
#c.JupyterHub.bind_url = 'http://:8000'
## Whether to shutdown the proxy when the Hub shuts down.
#

View File

@ -1,4 +1,5 @@
#!/bin/bash
set -e
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
@ -15,32 +16,62 @@ if [ ! -s "~/.ssh/authorized_keys" ]; then
fi
echo ""
echo "Install and config python & jupyter..."
apt-get update && \
apt-get install -y ipmitool && modprobe ipmi_devintf && \
curl -fsSL https://deb.nodesource.com/setup_current.x | bash - \
apt-get install -y python3-pip nodejs npm git && \
apt-add-repository -y ppa:cantera-team/cantera && \
apt-get install -y cantera-python3 && \
python3 -m pip install jupyterhub && \
npm install -g configurable-http-proxy && \
python3 -m pip install jupyterlab notebook jupyterlab-git tensorflow-gpu && \
python3 -m pip install h5py tqdm pandas ipywidgets pillow matplotlib && \
python3 -m pip install scipy scikit-learn && \
mkdir /etc/jupyterhub/ && \
cp jupyterhub_config.py /etc/jupyterhub/jupyterhub_config.py && \
cp jupyterhub.service /etc/systemd/system/jupyterhub.service && \
systemctl enable jupyterhub && \
echo "Install supermicro system tools..."
apt-get update
apt-get install -y ipmitool && modprobe ipmi_devintf
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 JupyterHub..."
apt-get install -y language-pack-de python3-pip
python3 -m pip install jupyterhub
npm install -g configurable-http-proxy
python3 -m pip install jupyterlab notebook jupyterlab-git
jupyter labextension install @jupyterlab/server-proxy
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..."
python3 -m pip install tensorflow-gpu
echo "Install cantera..."
apt-add-repository -y ppa:cantera-team/cantera
apt-get install -y cantera-python3
echo "Install common Python libs..."
python3 -m pip install h5py tqdm pandas ipywidgets pillow matplotlib opencv-python
#python3 -m pip install scipy scikit-learn numba
#System monitoring
#echo "Install netdata..."
#wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh
#echo "nvidia_smi: yes" >> /usr/lib/netdata/conf.d/python.d.conf
#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 "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
if [ $? -eq 0 ]; then
echo "check nvidia drivers..."
nvidia-smi
echo "show gpu state..."
nvidia-smi
echo ""
echo "Setup successfully finished"
echo ""
echo "Setup successfully finished"
fi

View File

@ -12,10 +12,15 @@ ssddev=/dev/sdb
#Block device to use with cache:
hdddev=/dev/sdc
#Cache sequential writes files, no cutoff
#There is an issue with parsing of prefixes, max 4 GB
#Name of the mounted device:
mountname=/mnt/bcache
#Cache setting for sequential writes
#There is an issue with parsing prefixes, max 4 GB, use 0 for no cutoff
sequential_cutoff=0
set -e
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
@ -32,39 +37,42 @@ while [ -b /dev/bcache0 ]; then
exit
fi
echo
echo "Clean disks and setup bcache... "
dd if=/dev/zero of=$ssddev bs=512 count=8 && \
dd if=/dev/zero of=$hdddev bs=512 count=8 && \
wipefs -a $ssddev && \
wipefs -a $hdddev && \
apt-get update && \
apt-get install -y bcache-tools && \
dd if=/dev/zero of=$ssddev bs=512 count=8
dd if=/dev/zero of=$hdddev bs=512 count=8
wipefs -a $ssddev
wipefs -a $hdddev
apt-get update
apt-get install -y bcache-tools
make-bcache -C $ssddev -B $hdddev --writeback
echo
echo "Wait until device is ready... "
while [ ! -b /dev/bcache0 ]; do sleep 1; done
if [ $? -eq 0 ]; then
echo "Config, format and mount bcache device... "
echo $sequential_cutoff > /sys/block/bcache0/bcache/sequential_cutoff && \
echo "ACTION==\"add\", SUBSYSTEM==\"block\", ENV{MAJOR}==\"252\", ATTR{bcache/sequential_cutoff}=\"$sequential_cutoff\"" \
> /etc/udev/rules.d/99-bcache_sequential_cutoff.rules && \
udevadm test /sys/block/bcache0 && \
mkfs.ext4 /dev/bcache0 && \
mkdir /mnt/bcache && \
mount /dev/bcache0 /mnt/bcache && \
echo "/dev/bcache0 /mnt/bcache ext4 rw 0 0" >> /etc/fstab
fi
echo
echo "Config bcache device... "
echo $sequential_cutoff > /sys/block/bcache0/bcache/sequential_cutoff
echo "ACTION==\"add\", SUBSYSTEM==\"block\", ENV{MAJOR}==\"252\", ATTR{bcache/sequential_cutoff}=\"$sequential_cutoff\"" \
> /etc/udev/rules.d/99-bcache_sequential_cutoff.rules
udevadm test /sys/block/bcache0
if [ $? -eq 0 ]; then
echo "Config default home directory for new users on bcache partition... "
mkdir /mnt/bcache/home && \
echo "#" >> /etc/default/useradd && \
echo "# Modifications:" >> /etc/default/useradd && \
echo "HOME=/mnt/bcache/home" >> /etc/default/useradd
fi
echo
echo "Format and mount bcache device..."
mkfs.ext4 /dev/bcache0
mkdir $mountname
mount /dev/bcache0 $mountname
echo "/dev/bcache0 $mountname ext4 rw 0 0" >> /etc/fstab
echo
echo "Config default home directory for new users on bcache partition... "
echo "home path of exising users will not be moved automaticaly"
mkdir $mountname/home
echo "#" >> /etc/default/useradd
echo "# Modifications:" >> /etc/default/useradd
echo "HOME=$mountname/home" >> /etc/default/useradd
echo
echo "Setup successfully finished"
if [ $? -eq 0 ]; then
echo ""
echo "Setup successfully finished"
fi

View File

@ -15,6 +15,8 @@
#sudo apt-get autoremove
#------------------------------------
set -e
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
@ -23,56 +25,56 @@ fi
distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
architecture="x86_64"
echo ""
echo "Disable cloud-init..."
#echo
#echo "Disable cloud-init..."
#this is optional, not a requirement
touch /etc/cloud/cloud-init.disabled
#touch /etc/cloud/cloud-init.disabled
echo ""
echo "Install requirements..."
apt-get update && \
echo
echo "Install pre-requirements..."
apt-get update
apt-get install -y linux-headers-$(uname -r) software-properties-common
if [ $? -eq 0 ]; then
echo ""
echo "Setup the CUDA repository public GPG key..."
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/7fa2af80.pub && \
wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/cuda-$distribution.pin && \
mv cuda-$distribution.pin /etc/apt/preferences.d/cuda-repository-pin-600
#add-apt-repository contrib
fi
if [ $? -eq 0 ]; then
echo ""
echo "Setup the CUDA network repository..."
add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/ /"
fi
echo
echo "Setup the CUDA repository public GPG key..."
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/7fa2af80.pub
wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/cuda-$distribution.pin
mv cuda-$distribution.pin /etc/apt/preferences.d/cuda-repository-pin-600
#add-apt-repository contrib
if [ $? -eq 0 ]; then
echo ""
echo "install CUDA..."
#Installs CUDA Toolkit and Driver packages.
#Use the --no-install-recommends option should prevent install any dependencies on X packages
#It still installes alot of dependencies, but fortunately it seams not to setup x-server
apt-get update && \
apt-get install -y --no-install-recommends cuda-11-2
fi
if [ $? -eq 0 ]; then
echo ""
echo "install libcudnn8..."
#Latest available version from nvidia ubuntu1804 repo
#For the current Ubuntu version it was not available. But it seams to work anyway.
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb && \
apt-get install -y ./libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb && \
rm ./libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb && \
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64.deb && \
apt-get install -y ./libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64.deb && \
rm ./libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64.deb
fi
if [ $? -eq 0 ]; then
echo ""
echo "Setup successfully finished"
echo "Type \"sudo systemctl reboot\" to reboot system for loading GPU drivers)"
fi
echo
echo "Setup the CUDA network repository..."
add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/ /"
echo
echo "Install CUDA..."
#Installs CUDA Toolkit and Driver packages.
#Use the --no-install-recommends option should prevent install any dependencies on X packages
#It still installes alot of dependencies, but fortunately it seams not to setup x-server
apt-get update
apt-get install -y --no-install-recommends cuda-11-2
echo
echo "Install libcudnn..."
apt-get install -y libcudnn8_8.1.1.33-1+cuda11.2 libcudnn8-dev_8.1.1.33-1+cuda11.2
#get an other version:
#wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb
#apt-get install -y ./libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb
#rm ./libcudnn8_8.1.1.33-1+cuda11.2_amd64.deb
#wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64.deb
#apt-get install -y ./libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64.deb
#rm ./libcudnn8-dev_8.1.1.33-1+cuda11.2_amd64.deb
echo
echo "Setup successfully finished"
echo "Type \"sudo systemctl reboot\" to reboot system for loading GPU drivers)"