-
Notifications
You must be signed in to change notification settings - Fork 0
/
Install-NvidiaDriver.bash
executable file
·34 lines (26 loc) · 1.09 KB
/
Install-NvidiaDriver.bash
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
#!/bin/bash
# Importing function run_as_root, get_os_type and get_os_version
source RunAsRoot.bash
source OsInfo.bash
# Running as root
run_as_root
# Checking if the computer has a NVIDIA GPU
if ! lspci | grep -i nvidia; then
exit 1
fi
# Checking if architecture is x86_64
if [ "$(uname -m)" != "x86_64" ] ; then
exit 1
fi
# Installing repository
if [ "$(get_os_type)" == "fedora" ]; then
dnf config-manager --add-repo "https://developer.download.nvidia.com/compute/cuda/repos/$(get_os_type)$(get_os_version)/x86_64/cuda-$(get_os_type)$(get_os_version).repo" || exit 1
elif [ "$(get_os_type)" == "rhel" ] || [ "$(get_os_type)" == "centos" ] || [ "$(get_os_type)" == "almalinux" ] || || [ "$(get_os_type)" == "ol" ]; then
dnf config-manager --add-repo "https://developer.download.nvidia.com/compute/cuda/repos/rhel$(get_os_version)/x86_64/cuda-rhel$(get_os_version).repo" || exit 1
fi
# Installing Nvidia driver
dnf module install --assumeyes nvidia-driver
# Installing Nvidia Cuda ToolKit
dnf install --assumeyes cuda-toolkit
# Installing GPUDirect Filesystem
dnf install --assumeyes nvidia-gds