From cf44be168e701703963ec9eed394a4aba5d11768 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 16 Mar 2022 01:35:27 +0100 Subject: [PATCH] pub key added, files renamed, disk setup added --- id_rsa_nicolas.pub | 1 + setup02.sh => setup_apps.sh | 16 ++++++++++++++-- setup01.sh => setup_cuda.sh | 16 ++++++++++++---- setup_drives.sh | 31 +++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 id_rsa_nicolas.pub rename setup02.sh => setup_apps.sh (69%) rename setup01.sh => setup_cuda.sh (88%) create mode 100644 setup_drives.sh diff --git a/id_rsa_nicolas.pub b/id_rsa_nicolas.pub new file mode 100644 index 0000000..33462f6 --- /dev/null +++ b/id_rsa_nicolas.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDDx67IZhPzb+MFktnkx04nlUYL6dzzqFv9bJnafY0/XTXDAMQaTVOk/HEbqxKwf4/KpWVlW+Upodkxq5WvpeDVRo5vRGf4Fns67v1A9Z2MpW0lHA1IK2JptjZSJ0XpOq/Q1UzobZti7onyzgcg2TQrnevRSe3gZFA9etXqxmmQ5nzXlhh17P2mq2GEx1dA6LGZl8CTNd0vB8ocFjgTQfl6yNOlwcSu2aQAwRowh/To9SBTiJIhASJVpkZs8DV/0eTHvWaPX7kKgdmU5NX5mV0a9gULEWMZgHxPf6hyHnPBnIFDoK+EiNlC569JL4FTcYK3qmEvDEH8Q2SqNHajWnhLGNqvtHT+/rPMnxUQt+7FpmfHxMWSkUlt3gyJySCkNeEjtf2XnUTLqbBOatb9QgifLu9wCxdK7fqYKsPkrQbJCz0zW71ZhQsIwQACzZNcuMj5AEUHNNEPv6eJ4ivKApa/nTSdtmWwj/DuRjjjmBgpqTfiwJG9Q5yUfnGpC9ttycXurC4/LLiwCnkEj3ZHZ8ZlD8ld0U4412GZsMFrY6dEaRS520FaIvnpSpAmkx7SNBH/3b6p9Rix2VLjeMRreAQo7phfmVSjTrjJx9skGOszEXl8IKbhd58nq5EAEEmhafOhkC6y4ab8UvrrjlAHGb8HrJLzloHIVIEnvYuaS9bJqw== nicolas@Nici diff --git a/setup02.sh b/setup_apps.sh similarity index 69% rename from setup02.sh rename to setup_apps.sh index 10d7eb5..f1c6185 100644 --- a/setup02.sh +++ b/setup_apps.sh @@ -9,19 +9,31 @@ fi # libnvinfer-dev=7.1.3-1+cuda11.0 \ # 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 + +echo "\n" +echo "Install and config python & jupyter..." apt-get update && \ apt-get install -y ipmitool && modprobe ipmi_devintf && \ apt-get install -y python3-pip nodejs npm git && \ python3 -m pip install jupyterhub && \ npm install -g configurable-http-proxy && \ python3 -m pip install jupyterlab notebook tensorflow jupyterlab-git && \ -python3 -m pip install tqdm pandas ipywidgets pillow matplotlib && \ +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 && \ -systemctl start jupyterhub +systemctl start jupyterhub + +if [ $? -eq 0 ]; then + echo "\n" + echo "Setup successfully finished" +fi #check nvidia drivers nvidia-smi diff --git a/setup01.sh b/setup_cuda.sh similarity index 88% rename from setup01.sh rename to setup_cuda.sh index 30db740..67df1df 100644 --- a/setup01.sh +++ b/setup_cuda.sh @@ -20,12 +20,14 @@ fi distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g') architecture="x86_64" -#Install drivers +echo "\n" +echo "Install drivers..." apt-get update && \ apt-get install -y linux-headers-$(uname -r) software-properties-common if [ $? -eq 0 ]; then - #Install the CUDA repository public GPG key + echo "\n" + echo "Install 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 @@ -33,11 +35,14 @@ if [ $? -eq 0 ]; then fi if [ $? -eq 0 ]; then - #Setup the CUDA network repository + echo "\n" + echo "Setup the CUDA network repository..." add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/$distribution/$architecture/ /" fi if [ $? -eq 0 ]; then + echo "\n" + echo "install CUDA..." #Installs all CUDA Toolkit and Driver packages. Handles upgrading to the next version of the cuda package when it's released. #Use the --no-install-recommends option for a lean driver install without any dependencies on X packages apt-get update && \ @@ -46,6 +51,8 @@ if [ $? -eq 0 ]; then fi if [ $? -eq 0 ]; then + echo "\n" + echo "install libcudnn8..." #Latest available version from ubuntu1804 repo: wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/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 && \ @@ -56,7 +63,8 @@ fi if [ $? -eq 0 ]; then #reboot system #systemctl reboot - echo "" + echo "\n" + echo "Setup successfully finished" echo "Type \"systemctl reboot\" to reboot system" fi diff --git a/setup_drives.sh b/setup_drives.sh new file mode 100644 index 0000000..a5782ff --- /dev/null +++ b/setup_drives.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +#https://stackoverflow.com/questions/20797819/command-to-change-the-default-home-directory-of-a-user + +#move user with files: +#usermod -m -d /newhome/username username + +#Simply open this file using a text editor, type: +#vi /etc/default/useradd +#The default home directory defined by HOME variable, find line that read as follows: +#HOME=/home +#Replace with: +#HOME=/iscsi/user +#Save and close the file. Now you can add user using regular useradd command: +# useradd vivek +# passwd vivek +#Verify user information: +# finger vivek + + +apt-get update && \ +apt-get install -y bcache-tools && \ +sudo dd if=/dev/zero if=/dev/sdb bs=512 count=8 && \ +sudo dd if=/dev/zero if=/dev/sdd bs=512 count=8 && \ +wipefs -a /dev/sdb && \ +wipefs -a /dev/sdd && \ +make-bcache -C /dev/sdd -B /dev/sdb --discard --writeback && \ +mkfs.ext4 /dev/bcache0 && \ +mkdir /mnt/bcache && \ +mount /dev/bcache0 /mnt/bcache && \ +echo "/dev/bcache0 /mnt/bcache ext4 rw 0 0" >> /etc/fstab \ No newline at end of file