Repurpose the Gaming Rig for running an AI ML/DL development/testing machine.
For a FreeBSD jail configuration check out - https://diyit.org/jails/mage.html
Install:
- Ubuntu 18.04 server from USB drive
- For Ubuntu 20.04 desktop check notes at end
Netplan:
ahlawat@game:/etc/netplan$ cat 01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
wifis:
wlo1:
dhcp4: true
dhcp6: true
access-points:
"sadmzas-a":
password: "your key"
Missing wpasupplicant:
- download to a usb-drive and mount on server these two packages
https://packages.ubuntu.com/bionic/wpasupplicant
https://packages.ubuntu.com/bionic/libpcsclite1
- sudo dpkg -i *.deb - install both packages
- sudo netplan apply - to connect wifi
ZFS Setup:
- apt install zfsutils-linux
- zpool create -f tank mirror /dev/sde /dev/sdf
Docker Setup:
- Create apt source-list file: /etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7EA0A9C3F273FCD8
- sudo apt update
- sudo apt install docker-ce
- sudo usermod -aG docker $USER
Docker with ZFS:
- sudo service docker stop
- sudo cp -au /var/lib/docker /var/lib/docker.bk
- sudo rm -rf /var/lib/docker/*
- zfs create tank/docker
- zfs set mountpoint=/var/lib/docker tank/docker
- Edit /etc/docker/daemon.json
{
"storage-driver": "zfs"
}
- service docker start
- docker info | grep zfs
TurboVNC Setup:
- curl -o turbovnc_2.2.5_amd64.deb https://sourceforge.net/projects/turbovnc/files/2.2.5/turbovnc_2.2.5_amd64.deb/download#
- sudo apt install gdebi-core
- sudo gdebi turbovnc_2.2.5_amd64.deb
- sudo apt install libsm6 x11-xkb-utils fluxbox xterm firefox
- /opt/TurboVNC/bin/vncserver -name game -geometry 1920x1080 :4
- Edit .vnc/ xstartup.turbovnc - replace references to "twm" with "fluxbox"
- sudo killall Xvnc; /opt/TurboVNC/bin/vncserver -name game -geometry 1920x1080 :4
Other Packages:
- sudo apt install tmux mc
- ahlawat@game:~$ cat .tmux.conf
unbind C-b
set -g prefix C-a
bind C-a send-prefix
setw -g mouse on
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
NVIDIA Docker:
- reference: https://github.com/NVIDIA/nvidia-docker#quickstart
- distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
- curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
- curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
- sudo apt update && sudo apt install -y nvidia-container-toolkit
- sudo service docker restart
NVIDIA CUDA:
- reference: https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=deblocal
- wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
- sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
- wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
- sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
- sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
- sudo apt update
- sudo apt -y install cuda
- nvidia-container-cli info
NVRM version: 440.33.01
CUDA version: 10.2
Device Index: 0
Device Minor: 0
Model: GeForce GTX 1080 Ti
Brand: GeForce
GPU UUID: GPU-0707abd3-94dc-f089-3977-6c23d8f3a540
Bus Location: 00000000:01:00.0
Architecture: 6.1
- docker run --gpus all nvidia/cuda:10.2-base nvidia-smi
Python Setup:
- reference: https://www.anaconda.com/distribution/
- wget https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh
- chmod 711 Anaconda3-2019.10-Linux-x86_64.sh
- ./Anaconda3-2019.10-Linux-x86_64.sh
- conda update -n base -c defaults conda
- conda install ipykernel
TensorFlow environment:
- conda create -y --name tfgpu python=3
- conda activate tfgpu
- conda install -y -c jupyter nb_conda
- conda install tensorflow-gpu
- python -c "import tensorflow as tf; print(tf.config.experimental.list_physical_devices('GPU'))"
Pytorch environment:
- conda create -y --name pytorch python=3
- conda activate pytorch
- conda install -y -c jupyter nb_conda
- conda install -y -c pytorch torchvision cudatoolkit pytorch
- python -c "import torch; print(torch.cuda.get_device_name(0))"
Jupyter Notebook environment:
- conda create -y --name jnb python=3
- conda activate jnb
- conda install -y -c jupyter nb_conda
- conda install -y -c numpy matplotlib
- jupyter notebook --generate-config
- Edit config-file
c.NotebookApp.allow_remote_access = True
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
- launch and connect to http://game:8888
- jupyter notebook &
Add environments to Jupyter
- python -m ipykernel install --user --name=tfgpu
- python -m ipykernel install --user --name=pytorch
- python -m ipykernel install --user --name=jnb
Visual Studio Code:
- wget https://go.microsoft.com/fwlink/?LinkID=760868 -O vs.deb
- sudo gdebi vs.deb
Ubuntu 20.04 Desktop version
- Ubuntu 20.04 desktop from USB drive
- for desktop vnc from MAC/Windows - vino disable incompatible encryption - $ gsettings set org.gnome.Vino require-encryption false
- enable screen sharing and automatic user login under settings
- Nvidia CUDA, get commands from here - https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=2004&target_type=deblocal
Current: 7/2020
- Anaconda - wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh
FreeBSD in grub
root@ahlawat-u20:/etc/grub.d# cat 40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "FreeBSD" {
set root=(hd1,2)
kfreebsd /boot/loader
}
root@ahlawat-u20:/etc/grub.d#
grub-mkconfig -o /boot/grub/grub.cfg
(base) ahlawat@ahlawat-u20:~/.vnc$ cat xstartup.turbovnc
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
XDG_SESSION_TYPE=x11; export XDG_SESSION_TYPE
OS=`uname -s`
which fluxbox >/dev/null && {
if [ -f $HOME/.Xresources ]; then xrdb $HOME/.Xresources; fi
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
fluxbox
} || {
echo "fluxbox not found. I give up."
exit 1
}
(base) ahlawat@ahlawat-u20:~/.vnc$