Red Hat based systems ship with an nvidia-compatible graphics kernel module called nouveau. Keeping this default configuration is recommended because nouveau is supported by Red Hat and is provided with each new kernel update.
However, in some situations the 3rd party proprietary graphics kernel module from nvidia is needed instead. This 3rd party kernel module is not supplied or supported by Red Hat. With each new kernel, a 3rd party kernel module (like the proprietary nvidia one) needs to be rebuilt. This process can be tedious and confusing (eg, why did my graphical login break after a reboot?). There is a framework named "DKMS" which stands for Dynamic Kernel Module Support. This enables the automatic rebuild of 3rd party kernel modules during the RPM install of a new kernel (ie, DKMS builds the nvidia driver as part of the kernel RPM install. This is done via hooks which are present in the kernel post-install RPM scriplet.
This document describes how to install the nvidia kernel module with DKMS support, so a manual rebuild of the nvidia kernel module is no longer required for every new kernel.
# lspci | grep -i nvidia
An example of what the output looks like (this is just the graphics card line from the output):
01:00.0 VGA compatible controller: NVIDIA Corporation GP107GL [Quadro P600] (rev a1)
https://www.nvidia.com/object/unix.html
It currently looks like this:
Linux x86_64/AMD/EM64T
Latest Long Lived Branch Version: 410.78
From the example in step 1, I found "Quadro P600" in the list of supported products. If you cannot find your model number, go back and look under the supported products for the Latest Legacy version
The current link (NON-legacy) from above is (as of 2018-Dec-7):
http://us.download.nvidia.com/XFree86/Linux-x86_64/410.78/NVIDIA-Linux-x86_64-410.78.run
And the current LEGACY driver as of 2018-Dec-10 is (this is for older systems / older graphics cards):
http://us.download.nvidia.com/XFree86/Linux-x86_64/390.87/NVIDIA-Linux-x86_64-390.87.run
An example of how to directly download one of the above using a command line:
# mkdir /scswork/ksa
# cd /scswork/ksa
# curl -sLO 'http://us.download.nvidia.com/XFree86/Linux-x86_64/410.78/NVIDIA-Linux-x86_64-410.78.run
# yum install dkms
Installing the dkms rpm should also prompt you to install the kernel-devel RPM (as a dependency). If you already have the kernel-devel RPM installed, you won't get prompted. The kernel-devel RPM is required for the nvidia kernel module to be built.
# /bin/sh ./NVIDIA-Linux-x86_64-[version].run --help
# /bin/sh ./NVIDIA-Linux-x86_64-[version].run -A
This is required by the nvidia installer. This will kick off anyone who is logged in at the video console. So check to see if anyone is logged in at ":0" which is the video console. You can use the 'w' command for this. Here is an example of someone logged in at the video console:
[root@lcls-fairley ~]# w
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
dfairley tty1 :0 Tue07 27:54m 0.00s 0.04s pam: gdm-password
If no one is logged in at ":0", or you get the OK to stop the graphical X server, then switch to runlevel 3:
# init 3
# /bin/sh ./NVIDIA-Linux-x86_64-[version].run --dkms --run-nvidia-xconfig --no-questions
If you prefer to have an interactive installation, and answer questions during the install:
# /bin/sh ./NVIDIA-Linux-x86_64-[version].run
The installer will build any required kernel modules. This could take quite a while (several minutes to 10s of minutes).
# init 5
# find /lib/modules | grep nvidia.ko
# lsmod | grep nvidia
# ps axuww | grep X
# ps axuwwf | less
/var/log/nvidia-installer.log
/var/log/Xorg.0.log
$ rpm -q --scripts kernel
-> /sbin/new-kernel-pkg
-> /etc/kernel/postinst.d/dkms
-> /usr/lib/dkms/dkms_autoinstaller
-> /usr/sbin/dkms
Taylor runs during the night, and taylor runs 'yum upgrade'. When there is a new kernel available, yum will install it. When it gets installed, the postinstall scripts in the RPM are run. Many things are run in the these postinstall scripts, including a script called '/sbin/new-kernel-pkg'. /sbin/new-kernel-pkg looks in the /etc/kernel/postinst.d/ directory and runs anything in there. /sbin/new-kernel-pkg finds a script called dkms inside the /etc/kernel/postinst.d/ directory. The /etc/kernel/postinst.d/dkms script runs the /usr/sbin/dkms script. The dkms man page describes how the build happens from here.
DKMS
See the dkms manual page, using the command: 'man dkms'
https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support
https://github.com/dell/dkms
Kernel Module Weak Updates
https://trapsink.com/wiki/Kernel_Module_Weak_Updates
Nouveau
https://nouveau.freedesktop.org/