This guide covers building packages of the NVIDIA driver for Red Hat Enterprise Linux (RHEL) 7 and related derivatives.
Multiple driver branches are installable from a single package repository using "flavors". The user can choose a specific driver branch or a virtual branch. Only updates on the selected branch will be considered, where the latest
and latest-dkms
flavors always update to the highest versioned driver release. While the XXX
flavors lock driver updates to the specified driver branch. Note: a XXX-dkms
flavor is not available for RHEL7.
Simplified switching between driver branches via a yum
plugin that complements installation and uninstallation of driver packages.
Special kernel module packages can be optionally built that implement an alternative to DKMS. The new approach does not require gcc
to be installed anymore, nor does the EPEL repository need to be enabled. The source files for the driver kmod packages are compiled in advance and then linked at installation time, hence these are called "precompiled drivers".
Datacenter location: http://us.download.nvidia.com/tesla/ (not browsable)
ex: http://us.download.nvidia.com/tesla/440.33.01/NVIDIA-Linux-x86_64-440.33.01.run
UDA location: http://download.nvidia.com/XFree86/Linux-x86_64/
ex: http://download.nvidia.com/XFree86/Linux-x86_64/440.64/NVIDIA-Linux-x86_64-440.64.run
GRID runfiles: NVIDIA-Linux-${arch}-${driver}-grid.run
are compatible.
CUDA runfiles: cuda_${toolkit}_${driver}_linux.run
are not compatible.
However a NVIDIA driver runfile can be extracted intact from a CUDA runfile:
sh cuda_toolkit _driver _linux.run --tar mxvf> ex: sh cuda_11.2.2_460.32.03_linux.run --tar mxvf
ls builds/NVIDIA-Linux-arch-driver .run> ex: ls builds/NVIDIA-Linux-x86_64-460.32.03.run
GitHub location: https://github.com/NVIDIA/nvidia-modprobe/releases
ex: https://github.com/NVIDIA/nvidia-modprobe/archive/460.32.03.tar.gz
UDA location: https://download.nvidia.com/XFree86/nvidia-modprobe
ex: https://download.nvidia.com/XFree86/nvidia-modprobe/nvidia-modprobe-460.56.tar.bz2
GitHub location: https://github.com/NVIDIA/nvidia-persistenced/releases
ex: https://github.com/NVIDIA/nvidia-persistenced/archive/460.32.03.tar.gz
UDA location: https://download.nvidia.com/XFree86/nvidia-persistenced
ex: https://download.nvidia.com/XFree86/nvidia-persistenced/nvidia-persistenced-460.56.tar.bz2
GitHub location: https://github.com/NVIDIA/nvidia-settings/releases
ex: https://github.com/NVIDIA/nvidia-settings/archive/460.32.03.tar.gz
UDA location: https://download.nvidia.com/XFree86/nvidia-settings
ex: https://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-460.56.tar.bz2
GitHub location: https://github.com/NVIDIA/nvidia-xconfig/releases
ex: https://github.com/NVIDIA/nvidia-xconfig/archive/460.32.03.tar.gz
UDA location: https://download.nvidia.com/XFree86/nvidia-xconfig
ex: https://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-460.56.tar.bz2
notes:
$arch
isx86_64
,ppc64le
, oraarch64
(sbsa)$major
is the first.
delimited field in the driver version,
ex:460
in460.32.03
$extension
isbz2
ORgz
depending on the tarballs downloaded$KERNEL
is string including distro tag and architecture,
ex:4.18.0-193.28.1.el7.aarch64
- Supports:
NVIDIA-Linux-${arch}-${version}-grid.run
export version="460.32.03"export VERSION="version"export major="460"export arch="x86_64"export extension="bz2"export KERNEL=$(uname -r)export IGNORE_CC_MISMATCH=1export RUN_FILE="/path/to/NVIDIA-Linux-*.run"export OUTPUT="HOME/rpm-nvidia"mkdir -p "OUTPUT"
note: Enable EPEL to install DKMS
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %rhel).noarch.rpm
note: store the package list in an array (easy
copy
&paste
)
# Packaginglist=("rpm-build")# Kernel modules (dkms-nvidia, precompiled-kmod)list+=("dkms")# Kernel headers and source code (precompiled-kmod)list+=("kernel-headers-KERNEL" "kernel-devel-KERNEL")# Compilationlist+=("m4" "gcc")# Misc (nvidia-driver & nvidia-persistenced)list+=("libappstream-glib" "libtirpc-devel")# Python (nvidia-plugin)list+=("python36")# Repository metadatalist+=("createrepo" "openssl")# Desktop integration (nvidia-settings)list+=("gtk2-devel" "gtk3-devel" "jansson-devel" "dbus-devel" "desktop-file-utils")# X.org utilties (nvidia-settings)list+=("libXext-devel" "libXrandr-devel")# GLVND (nvidia-settings)list+=("mesa-libGL-devel" "mesa-libEGL-devel")# Video extensions (nvidia-settings)list+=("libXxf86vm-devel" "libXv-devel" "libvdpau-devel")# Install all the build dependenciessudo yum install list[@]
> ex: sudo yum install -y rpm-build dkms m4 gcc \kernel-headers-KERNEL kernel-devel-KERNEL \libappstream-glib libtirpc-devel python36 createrepo openssl \gtk2-devel gtk3-devel jansson-devel dbus-devel desktop-file-utils \libXext-devel libXrandr-devel mesa-libGL-devel mesa-libEGL-devel \libXxf86vm-devel libXv-devel libvdpau-devel
note: for RHEL7-derivatives, checkout
rhel7
branch
git clone -b rhel7 https://github.com/NVIDIA/yum-packaging-nvidia-drivergit clone -b rhel7 https://github.com/NVIDIA/yum-packaging-dkms-nvidiagit clone -b rhel7 https://github.com/NVIDIA/yum-packaging-nvidia-kmod-commongit clone -b rhel7 https://github.com/NVIDIA/yum-packaging-nvidia-modprobegit clone -b rhel7 https://github.com/NVIDIA/yum-packaging-nvidia-persistencedgit clone -b rhel7 https://github.com/NVIDIA/yum-packaging-nvidia-settingsgit clone -b rhel7 https://github.com/NVIDIA/yum-packaging-nvidia-xconfiggit clone -b rhel7 https://github.com/NVIDIA/yum-packaging-nvidia-plugingit clone -b rhel7 https://github.com/NVIDIA/yum-packaging-precompiled-kmod
note: make sure
$VERSION
variable is set
cd yum-packaging-nvidia-driverrm -rf temp./nvidia-generate-tarballs-arch .sh
note: please wait, this step will take several minutes to complete
ls *.tar.xz> nvidia-driver-version-arch .tar.xz # x86_64 script does not have -${arch} suffix> nvidia-driver-version-i386.tar.xz # 32-bit libraries for x86_64 only> nvidia-kmod-version-arch .tar.xz # not used here
cd yum-packaging-nvidia-drivermkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp *.rules SOURCES/cp *.conf SOURCES/cp nvidia-driver-version-arch .tar.xz SOURCES/cp nvidia-driver.spec SPECS/# latest-dkmsrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest-dkms" \--define "is_dkms 1" \--define "is_latest 1" \--define "is_grid 1" \--define "epoch 3" \--target "arch " \-v -bb SPECS/nvidia-driver.spec# latestrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest" \--define "is_dkms 0" \--define "is_latest 1" \--define "is_grid 1" \--define "epoch 3" \--target "arch " \-v -bb SPECS/nvidia-driver.spec# branch-XXXrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch branch-major" \--define "is_dkms 0" \--define "is_latest 0" \--define "is_grid 1" \--define "epoch 3" \--target "arch " \-v -bb SPECS/nvidia-driver.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
Copy tarball from yum-packaging-nvidia-driver
cd yum-packaging-dkms-nvidiarsync -av ../yum-packaging-nvidia-driver/nvidia-kmod-version-arch .tar.xz PWD/cd -
Generate tarball from runfile
cd yum-packaging-dkms-nvidiash "RUN_FILE" --extract-only --target extractmkdir nvidia-kmod-version-archmv extract/kernel nvidia-kmod-version-arch /tar -cJf nvidia-kmod-version-arch .tar.xz nvidia-kmod-version-archcd -
cd yum-packaging-dkms-nvidiamkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp dkms-nvidia.conf SOURCES/cp nvidia-kmod-version-arch .tar.xz SOURCES/cp dkms-nvidia.spec SPECS/# latest-dkmsrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest-dkms" \--define "is_dkms 1" \--define "is_latest 1" \--define "epoch 3" \--target "arch " \-v -bb SPECS/dkms-nvidia.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
cd yum-packaging-nvidia-kmod-commonmkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp 60-nvidia.rules SOURCES/cp 99-nvidia.conf SOURCES/cp nvidia.conf SOURCES/cp nvidia-kmod-common.spec SPECS/rpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "epoch 3" \--target "noarch" \-v -bb SPECS/nvidia-kmod-common.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
cd yum-packaging-nvidia-modprobemkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp ../nvidia-modprobe-version .tar.* SOURCES/cp *.patch SOURCES/cp nvidia-modprobe.spec SPECS/# latest-dkmsrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest-dkms" \--define "is_dkms 1" \--define "is_latest 1" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-modprobe.spec# latestrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest" \--define "is_dkms 0" \--define "is_latest 1" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-modprobe.spec# branch-XXXrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch branch-major " \--define "is_dkms 0" \--define "is_latest 0" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-modprobe.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
cd yum-packaging-nvidia-persistencedmkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp ../nvidia-persistenced-version .tar.* SOURCES/cp *init* SOURCES/cp *.service SOURCES/cp nvidia-persistenced.spec SPECS/# latest-dkmsrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest-dkms" \--define "is_dkms 1" \--define "is_latest 1" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-persistenced.spec# latestrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest" \--define "is_dkms 0" \--define "is_latest 1" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-persistenced.spec# branch-XXXrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch branch-major " \--define "is_dkms 0" \--define "is_latest 0" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-persistenced.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
cd yum-packaging-nvidia-settingsmkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp ../nvidia-settings-version .tar.* SOURCES/cp *.desktop SOURCES/cp *.patch SOURCES/cp *.xml SOURCES/cp nvidia-settings.spec SPECS/rpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-settings.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
cd yum-packaging-nvidia-xconfigmkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp ../nvidia-xconfig-version .tar.* SOURCES/cp *.patch SOURCES/cp nvidia-xconfig.spec SPECS/# latest-dkmsrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest-dkms" \--define "is_dkms 1" \--define "is_latest 1" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-xconfig.spec# latestrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch latest" \--define "is_dkms 0" \--define "is_latest 1" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-xconfig.spec# branch-XXXrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "version version" \--define "driver_branch branch-major " \--define "is_dkms 0" \--define "is_latest 0" \--define "epoch 3" \--define "extension extension" \-v -bb SPECS/nvidia-xconfig.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
cd yum-packaging-nvidia-pluginmkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp nvidia.conf SOURCES/cp nvidia-yum.py SOURCES/cp yum-plugin-nvidia.spec SPECS/rpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \-v -bb SPECS/yum-plugin-nvidia.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
note: this is an optional step
Copy tarball from yum-packaging-nvidia-driver
cd yum-packaging-precompiled-kmodrsync -av ../yum-packaging-nvidia-driver/nvidia-kmod-version-arch .tar.xz PWD/
Generate tarball from runfile
cd yum-packaging-precompiled-kmodsh "RUN_FILE" --extract-only --target extractmkdir nvidia-kmod-version-archmv extract/kernel nvidia-kmod-version-arch /tar -cJf nvidia-kmod-version-arch .tar.xz nvidia-kmod-version-arch
Generate X.509 public_key.der
and private_key.priv
files.
Example x509-configuration.ini. Replace $USER
and $EMAIL
values.
cd yum-packaging-precompiled-kmodopenssl req -x509 -new -nodes -utf8 -sha256 -days 36500 -batch \-config x509-configuration.ini \-outform DER -out public_key.der \-keyout private_key.priv
export kernel_main=$(echo "KERNEL" | awk -F "-" '{print $1}')export kernel_suffix=$(echo "KERNEL" | awk -F "-" '{print $2}' | sed "s|\.arch||")export kernel_dist=$(echo "kernel_suffix" | awk -F "." '{print $NF}')export kernel_release=$(echo "kernel_suffix" | sed "s|\.kernel_dist||")> ex:kernel_main="4.18.0"kernel_release="193.28.1"kernel_dist="el7"
note: compilation may take up to 10 minutes (depending on hardware)
cd yum-packaging-precompiled-kmodmkdir BUILD BUILDROOT RPMS SRPMS SOURCES SPECScp nvidia-kmod-version-arch .tar.xz SOURCES/cp public_key.der SOURCES/cp private_key.priv SOURCES/cp kmod-nvidia.spec SPECS/# latestrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "kernel kernel_main" \--define "kernel_release kernel_release" \--define "kernel_dist kernel_dist" \--define "driver version" \--define "epoch 3" \--define "driver_branch latest"--target arch-v -bb SPECS/kmod-nvidia.spec# branch-XXXrpmbuild \--define "%_topdir \ "--define "debug_package %{nil}" \--define "kernel kernel" \--define "kernel_release release" \--define "kernel_dist dist" \--define "driver version" \--define "epoch 3" \--define "driver_branch branch-major " \--target arch-v -bb SPECS/kmod-nvidia.specfind -name "*.rpm" -exec cp -v {} OUTPUT/ \;cd -
mkdir my-custom-repo# NVIDIA driver packagescp -v OUTPUT/*.rpm my-custom-repo/
createrepo -v --database my-custom-repo
Create custom.repo
file
[custom]name=custombaseurl=file:///path/to/my-custom-repoenabled=1gpgcheck=0
Copy to system path for yum
package manager
sudo cp custom.repo /etc/yum.repos.d/
Clean yum
cache
sudo yum clean all
To uninstall a CUDA toolkit runfile installation
sudo /usr/local/cuda-X.Y/bin/cuda-uninstall
To uninstall a standalone NVIDIA driver runfile installation:
sudo /usr/bin/nvidia-uninstall
To uninstall an RPM installation:
sudo yum remove "*nvidia-driver*" "*nvidia-settings*"
To disable CUDA repository:
sudo yum-config-manager --set-disabled cuda
latest
, branch-XXX
, latest-dkms
Then to installsudo yum install nvidia-driver-flavor> ex: sudo yum install nvidia-driver-latest
nvidia-settings
sudo yum install cuda-drivers
To select an installation branch, choose only one from the three options below:
Always update to the highest versioned driver (precompiled).
sudo yum install nvidia-driver-latest
Lock the driver updates to the specified driver branch (precompiled).
sudo yum install nvidia-driver-branch-XXX
note:
XXX
is the first.
delimited field in the driver version, ex:460
in460.32.03
Always update to the highest versioned driver (non-precompiled).
sudo yum install nvidia-driver-latest-dkms
note: DKMS install uses compilation for
kmod-nvidia-latest-dkms
package (make take up to 10 minutes depending on hardware)
Presentations: https://github.com/NVIDIA/yum-packaging-precompiled-kmod#Presentations
Report a bug: https://developer.nvidia.com/nvidia_bug/add
note: If you are not already a member, join the NVIDIA Developer Program: https://developer.nvidia.com/join