Skip to content

Instantly share code, notes, and snippets.

@dacbd
Last active June 13, 2022 16:51
Show Gist options
  • Save dacbd/c527d1a214f7118e6d66e52a6abb4c4f to your computer and use it in GitHub Desktop.
Save dacbd/c527d1a214f7118e6d66e52a6abb4c4f to your computer and use it in GitHub Desktop.
Install GPU drivers from src
#!/bin/bash
driver_version="515.48.07"
nvidia_dl_path="https://us.download.nvidia.com/XFree86/Linux-x86_64/"
__temp=$(mktemp -d)
pushd "$__temp" || exit
apt-get update -y
apt-get install -y git build-essential
wget "$nvidia_dl_path$driver_version/NVIDIA-Linux-x86_64-$driver_version.run" -O web-installer
git clone --depth 1 --branch "$driver_version" https://github.com/NVIDIA/open-gpu-kernel-modules.git
pushd open-gpu-kernel-modules || exit
make modules -j"$(nproc)"
make modules_install -j"$(nproc)"
popd || exit
# [--silent] is [--ui=none --no-questions]
sh ./web-installer --silent --no-kernel-modules
# uninstall and reinstall because reasons?
sh ./web-installer --silent --uninstall
sh ./web-installer --silent --no-kernel-modules
popd || exit
sleep 5
nvidia-smi
lsmod
if lsmod | grep -q nvidia ; then
echo "Install Complete"
else
echo "Install Failed"
fi
# No reboot required
#!/bin/bash
driver_version="515.48.07"
nvidia_dl_path="https://us.download.nvidia.com/XFree86/Linux-x86_64/"
__temp=$(mktemp -d)
pushd "$__temp" || exit
wget "$nvidia_dl_path$driver_version/NVIDIA-Linux-x86_64-$driver_version.run" -O web-installer
git clone --depth 1 --branch "$driver_version" https://github.com/NVIDIA/open-gpu-kernel-modules.git
pushd open-gpu-kernel-modules || exit
make modules -j"$(nproc)"
make modules_install -j"$(nproc)"
popd || exit
# [--silent] is [--ui=none --no-questions]
sh ./web-installer --silent --no-kernel-modules
# uninstall and reinstall because reasons?
sh ./web-installer --silent --uninstall
sh ./web-installer --silent --no-kernel-modules
popd || exit
sleep 5
nvidia-smi
lsmod
if lsmod | grep -q nvidia ; then
echo "Install Complete"
else
echo "Install Failed"
fi
# No reboot required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment