CentOS 7 & Nvidia kmod tutorial

Updated: December 2, 2015

Ladies and gentlemen, you know I like CentOS quite a bit. It's really a dandy operating system, for home use as well as work, or if you want, the other way around, and it really surprises with its simplicity and flexibility. True, we started on the wrong foot due to a rather severe lack of extra repos and stuff, then we fixed it, and pimped it to the max.

With the release of build 1503, things are looking even brighter, and I thought this would be a good opportunity to refresh my Nvidia guide for this fine distro, and this time show you how it's done using the ELRepo kmod package, so you don't have to manually reinstall the driver every time there's a kernel upgrade. Let us.

Teaser

Preparations

You don't need to bother too much, but it's always useful to have the necessary build tools in place and blacklist Nouveau, which we have already learned how to do in the first article. Now, once this step is done, we need a new repo. To add the ELRepo, uh, repo, you will need to perform two steps. The first one is to get the repository key, so you don't get warnings about unsigned packages.

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

And after that, install the binary. Do note the exact version could change, so consult the website if you get a 404 not found error.

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

Search for Nvidia drivers

Next, let's search for the drivers - yum search nvidia. You will get a long list of entries, and we need to understand what we get here. What you want is the kmod-nvidia package with the right architecture (32-bit or 64-bit) and the driver version that best suits your needs. Even on my elderly LG laptop, the 340 series is quite all right.

Then, you also want the compatibility files that match the selected version. Lastly, it's not a bad idea to also install the nvidia-detect tool, which can also check for conflicts. The results are self-explanatory, but I can understand where people new to Linux or CentOS might struggle.

kmod-nvidia.x86_64 : nvidia kernel module(s)
kmod-nvidia-304xx.x86_64 : nvidia-304xx kernel module(s)
kmod-nvidia-340xx.x86_64 : nvidia-340xx kernel module(s)
nvidia-detect.x86_64 : NVIDIA graphics card detection utility
nvidia-x11-drv.x86_64 : NVIDIA OpenGL X11 display driver files
nvidia-x11-drv-304xx.x86_64 : NVIDIA 304xx OpenGL X11 display driver files
nvidia-x11-drv-304xx-32bit.x86_64 : Compatibility 32-bit files for the 64-bit : Proprietary NVIDIA driver
nvidia-x11-drv-32bit.x86_64 : Compatibility 32-bit files for the 64-bit : Proprietary NVIDIA driver
nvidia-x11-drv-340xx.x86_64 : NVIDIA OpenGL X11 display driver files
nvidia-x11-drv-340xx-32bit.x86_64 : Compatibility 32-bit files for the 64-bit : Proprietary NVIDIA driver
yum-plugin-nvidia.noarch : Yum plugin to prevent update of NVIDIA drivers on : unsupported hardware
bumblebee.x86_64 : Bumblebee is a project that enables Linux to utilize the : Nvidia Optimus Hybrid cards
xorg-x11-drv-nouveau.x86_64 : Xorg X11 nouveau video driver for NVIDIA graphics : chipsets

Our final set includes:

yum install kmod-nvidia-340xx.x86_64 nvidia-x11-drv-340xx.x86_64 nvidia-detect.x86_64

Installation & glamor warning

The driver will now install. This can take a few minutes. Relax!

Installing

During the setup, you may also get a warning, informing you that one of the installed packages is incompatible with the kmod driver. You will need to resolve this conflict.

WARNING:
Disable glamoregl or uninstall xorg-x11-glamor
See: http://elrepo.org/tiki/kmod-nvidia (Known Issues) for more information

What this is about? Well glamor is a part of the ATI driver framework, so this definitely does not work with Nvidia, which is why you should remove the package after you finish installing the driver.

yum remove xorg-x11-glamor
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package xorg-x11-glamor.x86_64 0:0.6.0-2.20140918git347ef4f.el7 will be erased
--> Processing Dependency: libglamor.so.0()(64bit) for package: xorg-x11-drv-ati-7.4.0-1.20140918git56c7fb8.el7.x86_64
--> Running transaction check
---> Package xorg-x11-drv-ati.x86_64 0:7.4.0-1.20140918git56c7fb8.el7 will be erased
--> Processing Dependency: xorg-x11-drv-ati for package: xorg-x11-drivers-7.7-6.el7.x86_64
--> Running transaction check
---> Package xorg-x11-drivers.x86_64 0:7.7-6.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package          Arch   Version    Repository         Size
================================================================================
Removing:
xorg-x11-glamor  x86_64 0.6.0-2... @base/$releasever  258 k
Removing for dependencies:
xorg-x11-drivers x86_64 7.7-6...   @base/$releasever  0.0 
xorg-x11-drv-ati x86_64 7.4.0...   @base/$releasever  444 k

Transaction Summary
================================================================================
Remove  1 Package (+2 Dependent packages)

Installed size: 702 k
Is this ok [y/N]:

Reboot and enjoy

And that's it. Now, your CentOS 7 is even perfecter than before. Don't forget my pimping guide, or the sequel, which guarantees you will be having all the fine bits and pieces like LibreOffice, VLC, Steam, Skype, Chrome, and other cool and useful software.

CentOS, ready

Conclusion

There you go, another fine topic mastered and slain. This one is really cool, because it allows you to have Nvidia drivers as a seamless part of your overall CentOS experience, without any manual tampering and tweaking. Indeed, if you look at my two guides for how to enhance the basic CentOS set into a perfect desktop, it comes down to several extra repositories, and very little manual work. Good stuff. Just like Ubuntu.

Well, this should come handy. You've learned how to work with additional repositories, search for drivers, and even fix a conflict with the default package set. Now, your CentOS karma should be complete. Or whole. However karma is measured. Take care.

Cheers.