Nvidia drivers on CentOS 7
Since RPM Fusion doesn’t support RHEL / CentOS 7 and I didn’t feel like dealing with the Nvidia installer, I tried to find alternative package repositories. Fortunately I came across ELRepo which has been providing Nvidia drivers (from the long-lived branch release) in form of precompiled kernel drivers (kmod-nvidia) for a few months.
I tested it on a fresh CentOS 7 installation (using the GNOME Desktop option) and it was pretty straightforward.
Import the rpm GPG key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
Install ELRepo
yum install http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Remove Glamor
This is an open source Xorg graphics driver that may cause conflicts with proprietary drivers. If the package is installed it needs to be removed.
yum remove xorg-x11-glamor
Install nvidia-detect [ optional ]
This is a small utility which detects graphic cards, suggests specific driver versions and checks compatibility with Xorg.
yum install nvidia-detect
Sample output:
nvidia-detect -x Probing for supported NVIDIA devices... [10de:11c0] NVIDIA Corporation GK106 [GeForce GTX 660] This device requires the current 340.32 NVIDIA driver kmod-nvidia [10de:11c0] NVIDIA Corporation GK106 [GeForce GTX 660] This device requires the current 340.32 NVIDIA driver kmod-nvidia Checking ABI compatibility with Xorg Server... Xorg Video Driver ABI detected: 15 ABI compatibility check passed
Install kmod-nvidia
When running a 64bit OS, the 32bit Nvidia libraries may also be needed for compatibility, I always install them. The good thing is that kmod-nvidia also disables nouveau automatically, so no more manually tweaking modprobe and grub :)
yum install kmod-nvidia nvidia-x11-drv-32bit
via elrepo.org
I just tried this but after reboot there is no desktop. It just goes grub menu then nothing but a black screen with a flashing cursor in the top left corner. Do you have any suggestions before I uninstall nvidia?
I’m running a reasonably fresh CentOS 7 install with gnome desktop option as well.
@DS: It could be the nouveau driver causing conflicts with nvidia. After installing kmod-nvidia a new file is created /usr/lib/modprobe.d/blacklist-nouveau.conf that blacklists nouveau. Do you have it on your machine? As per this file, if nouveau continues to load run this as root:
@admin: Thanks for taking the time. Yes the blacklist-nouveau.conf file was created during the process. After running the dracut cmd I still had the same problem. Not sure what is going on. I’ve also attempted to download the nvidia driver “.run” file and install it that way but I get the same blank screen problem..
I’m starting to get out of my depth here. I might get a colleague to take a look who has a bit more of a sys-admin background than myself. I’ll let you know how I get on.
take a look at /etc/sysconfig/grub and look for these in GRUB_CMDLINE_LINUX
nouveau.modeset=0
rd.driver.blacklist=nouveau
this is documented in the rhel7 release notes, simply adding it to modprobe.d is not enough.
take a look at /etc/sysconfig/grub and look for these in GRUB_CMDLINE_LINUX
nouveau.modeset=0
rd.driver.blacklist=nouveau
this is documented in the rhel7 release notes, simply adding it to modprobe.d is not enough….
So what does it mean if it is there? Does it need to be removed from there?
@jay warren: those lines should be added automatically by kmod-nvidia
@sleever: if those lines are there, it means the Nouveau driver is blacklisted, which is good if you have the Nvidia driver installed
Ran into the blinking cursor problem too. The problem seems to be due to $@&*^% M$ and their UEFI. You may have to simply do a re-install boot from a NON UEFI enabled device and then when you do the install make sure there is NO partition marked /boot/efi, but you *will* need a /boot partition. If you encounter a /boot/efi partition remove it, and continue with the install. Once you have the system up and running follow the above and reboot, and PRESTO!! like magic Nvidia will be up and running. The key to the whole blinking cusor problem is to ensure you DO NOT boot from a UEFI enabled device, and to remove any /boot/efi partition during the install phase.
If you’re using SecureBoot, you’ll need to follow the steps linked below for the kernel module to load correctly. You have to get the UEFI shim to trust ELRepo’s signing key.
https://www.elrepo.org/tiki/SecureBootKey
Thanks for sharing this tutorial. Works fine for RHEL 7.2 . After fighting a lot with the NVIDIA installer finally this mothod worked witout any issue.
How do you check that the Nvidia driver is properly installed?
shows if the Nvidia kernel module is in use.
I followed all the steps. Also modified the bumblebee.conf file as suggested on other sites (I have optimus laptop with GT650M). But my login screen doesn’t appear, although I can still use other terminals. I have to uninstall kmod-nvidia in order to get the screen back. Can someone help me please? Thanks.
I haven’t checked this article in a while, please search for newer howto’s such as one here: https://linuxhint.com/install-nvidia-drivers-centos/
these instructions don’t work, it says nvidia driver conflicts with bumblebee drivers. but the instructions say install both, i don’t get it.
Doesn’t work with CentOS 7 and Lenovo laptop running MX150 nvidia card. The package is missing in ELRepo “nvidia-x11-drv-32bit” and the only package with “32bit” in the name is an nvidia driver version 340.
Installing the nvidia driver manually is working fine on the Lenovo T580 and P52.