forked from Saberwolf64/Proxmox-Nvidia-LXC-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Nvidia-driver-setup.sh
42 lines (36 loc) · 1.51 KB
/
Nvidia-driver-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
#removal of Nouveau driver from system
# cat <<e > /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
# # generated by nvidia-installer
# blacklist nouveau
# options nouveau modeset=0
# e
# rmmod nouveau
# Setup temporary environment
trap cleanup EXIT
function cleanup() {
popd >/dev/null
rm -rf $TMP_DIR
}
TMP_DIR=$(mktemp -d)
pushd $TMP_DIR >/dev/null
# Install NVidia drivers prerequisites
apt-get install -qqy pve-headers-`uname -r` gcc make
# Install NVidia drivers
LATEST_DRIVER=$(wget -qLO - https://download.nvidia.com/XFree86/Linux-x86_64/latest.txt | awk '{print $2}')
LATEST_DRIVER_URL="https://download.nvidia.com/XFree86/Linux-x86_64/${LATEST_DRIVER}"
INSTALL_SCRIPT=$(basename $LATEST_DRIVER_URL)
wget -qLO $INSTALL_SCRIPT $LATEST_DRIVER_URL
bash $INSTALL_SCRIPT --silent
# Install NVidia Persistenced
#/usr/share/doc/NVIDIA_GLX-1.0/sample/nvidia-persistenced-init.tar.bz2
if [ -f /usr/share/doc/NVIDIA_GLX-1.0/samples/nvidia-persistenced-init.tar.bz2 ]; then
tar -jxvf /usr/share/doc/NVIDIA_GLX-1.0/samples/nvidia-persistenced-init.tar.bz2
bash ./nvidia-persistenced-init/install.sh
fi
# Install NVidia Container Runtime
wget -qLO - https://nvidia.github.io/nvidia-container-runtime/gpgkey | apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
wget -qLO - https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | tee /etc/apt/sources.list.d/nvidia-container-runtime.list
apt-get update
apt-get install -qqy nvidia-container-runtime