# gpu passthrought vm setting
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf && echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf && sudo update-initramfs -u && sudo modprobe -r nouveau && sudo modprobe nouveau && sudo apt-get update && sudo apt-get install libc-dev -y && sudo apt-get install linux-headers-$(uname -r) -y && wget https://tw.download.nvidia.com/tesla/525.105.17/NVIDIA-Linux-x86_64-525.105.17.run && sudo sh NVIDIA-Linux-x86_64-525.105.17.run --accept-license --no-questions --dkms -s
## Update & Upgrade system
```
sudo apt update
sudo apt upgrade
```
`sudo reboot`
## Install kernel header file
```
sudo apt install linux-headers-$(uname -r)
```
## Install Desktop Environment
### GNOME
#### Installing GNOME Full Version
```
sudo apt install gnome-session gdm3
sudo apt install ubuntu-gnome-desktop
```
#### Installing GNOME Minimal Version
```
sudo apt install ubuntu-desktop-minimal
```
#### Installing GNOME Vanilla Version
```
sudo apt install vanilla-gnome-desktop
```
### XFCE
#### Installing Xfce Full Version
```
sudo apt install xubuntu-desktop
```
#### Installing Xfce Minimal Version
```
sudo apt install xfce4
```
### MATE
#### Installing mate Full Version
```
sudo apt install ubuntu-mate-desktop mate-desktop-environment-extras
```
#### Installing mate Minimal Version
```
sudo apt install ubuntu-mate-desktop
```
## Installing
sudo apt install novnc python3-numpy debsig-verify
sudo apt install x11-utils mesa-utils language-pack-zh-hant fcitx5 fcitx5-chewing fonts-noto-cjk fonts-noto-cjk-extra fonts-arphic-ukai fonts-arphic-uming libfontconfig1 libx11-6 libxkbcommon0 libxcb-xinput0 libxcb-xinerama0 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 dbus-x11 fontconfig libegl1-mesa adwaita-icon-theme-full gedit
openjdk-11-jre
## Disable Nouveau driver before install NVIDIA cuda driver
```
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf
sudo update-initramfs -u
sudo modprobe -r nouveau
sudo reboot
```
## Installing CUDA
distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-key del 7fa2af80
sudo apt update
sudo apt install cuda
sudo apt install libcudnn8 libcudnn8-dev
https://medium.com/@yt.chen/nvidia-smi-%E9%80%A3%E4%B8%8D%E5%88%B0-driver-%E7%9A%84%E8%87%AA%E6%95%91%E6%96%B9%E6%B3%95-69cbed16171d
## Installing Google Chrome Using the Official PPA
### Add the GPG Key of the Repository
```
wget -q -O- https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmour -o /usr/share/keyrings/google-chrome.gpg
```
### Adding the Chrome PPA
```
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list'
```
### Update Package Lists and Install
```
sudo apt update
sudo apt install google-chrome-stable
```
## Install conda
### Add the GPG Key of the Repository
```
wget -q -O- https://repo.anaconda.com/pkgs/misc/gpgkeys/anaconda.asc | sudo gpg --dearmour -o /usr/share/keyrings/conda.gpg
```
### Adding the conda PPA
```
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/conda.gpg] https://repo.anaconda.com/pkgs/misc/debrepo/conda/ stable main" > /etc/apt/sources.list.d/conda.list'
```
### Update Package Lists and Install
```
sudo apt update
sudo apt install conda
```
## Installing TurboVNC
### Download DEB package
```
wget 'https://github.com/TurboVNC/turbovnc/releases/download/3.1.2/turbovnc_3.1.2_amd64.deb'
wget 'https://github.com/VirtualGL/virtualgl/releases/download/3.1.1/virtualgl_3.1.1_amd64.deb'
wget 'https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/3.0.4/libjpeg-turbo-official_3.0.4_amd64.deb'
```
### To verify the DEB package signatures
```
wget https://gist.github.com/dcommander/2960e99d4a4f6998e249ec7cfec89b85/debsig-import
chmod a+x debsig-import
sudo ./debsig-import 4BACCAB36E7FE9A1 'https://www.turbovnc.org/key/VGL-GPG-KEY'
sudo ./debsig-import 7EC2DBB6F4DBF434 'https://www.libjpeg-turbo.org/key/LJT-GPG-KEY'
sudo ./debsig-import 4BACCAB36E7FE9A1 'https://www.virtualgl.org/key/VGL-GPG-KEY'
debsig-verify turbovnc_3.0.91_amd64.deb
debsig-verify libjpeg-turbo-official_3.0.1_amd64.deb
debsig-verify virtualgl_3.1_amd64.deb
```
### Install Package
```
sudo dpkg -i turbovnc_3.0.91_amd64.deb libjpeg-turbo-official_3.0.1_amd64.deb virtualgl_3.1_amd64.deb
```
sudo vi /etc/environment
VNCPASSWD=123qwe
QT_QPA_PLATFORM=offscreen vnc
#
## system scope
sudo vi /etc/crontab
@reboot ubuntu sleep 10 && echo $VNCPASSWD | /opt/TurboVNC/bin/vncpasswd -f > /home/ubuntu/.vnc/passwd && /opt/TurboVNC/bin/vncserver
@reboot ubuntu sleep 20 && websockify -D --web=/usr/share/novnc/ 6080 localhost:5901
## user scope
crontab -e
@reboot echo $VNCPASSWD | /opt/TurboVNC/bin/vncpasswd -f > /home/ubuntu/.vnc/passwd && /opt/TurboVNC/bin/vncserver
@reboot websockify -D --web=/usr/share/novnc/ 6080 localhost:5901
/opt/TurboVNC/bin/vncserver -novnc /usr/share/novnc/
http://host:5801/vnc.html?host=host&port=5901