You are here: Home > Computer Articles > Getting Nvidia Drivers Installed on CentOS 7
Back to all articles

Getting Nvidia Drivers Installed on CentOS 7

Published:


Red Hat Enterprise Linux (RHEL) has become one of the most popular and well-respected operating systems to grace the data centers and core infrastructure of institutions all over the world. It is well supported, secure and provides a level of standardization that is hard to find in the FOSS world.

Unfortunately is also very expensive, which is why we have CentOS, a downstream distribution of RHEL that tries to stay 100% compatible with everything designed to work with it’s pricey relative.

Many Linux distributions, including CentOS, don’t use the closed-source proprietary driver from Nvidia. Instead they opt for an open source alternative called Nouveau. The thing is, it’s not as good or compatible as the real deal from the GPU maker, so we often have clients who can’t figure out how to update or install GeForce drivers on their CentOS machines.

So here’s how you do it. Once you know it’s easy to repeat in case you ever need to install new GPU drivers.

Setting the Stage
Before we can actually install the drivers, we have to make sure that the computer is ready to work with the latest version available. The new drivers are written for the latest kernel, so we have to make sure it’s updated or the process could run into errors.

Doing this is pretty easy. Open the command line and write:

yum update

Once you’re done with the update, reboot the system.

Next we want to do some housekeeping around the kernel to make sure everything matches up. So in the command line execute this:

yum install kernel-devel-$(uname -r) gcc

Finding Your Driver
Before you can go any further, you need to actually get your hands on the Nvidia Geforce drivers. You can find the latest drivers here. Be sure to pick the right version for your operating system and CPU. Most people will use the X86-64/AMD64/EMT64T version.

Putting a Stop to Nouveau
To ensure that the whole installation goes smoothly, we have to pull the plug on Nouveau. S you’ve probably figured out, killing the running graphics driver before installing your new one means there’s no GUI. Well, technically that’s because we’re also going to kill the GUI for maximum success. Either way, you should print out this document or read it on your smartphone, since the Linux machine will not be available for graphical uses once you move on to this next part.

We are going to blacklist Nouveau AND kill the graphical desktop manager. Don’t worry, the desktop manager will be back. Here’s what you need to put in the command line:

echo 'blacklist nouveau' >> /etc/modprobe.d/blacklist.conf

dracut /boot/initramfs-$(uname -r).img $(uname -r) --force

systemctl disable gdm

reboot


Your system will restart and when it’s done you’ll only see the command line. Don’t worry, it may looks scary, but everything is still on track.

Feeling the GeForce
Now we can install the file that you downloaded from the Nvidia site earlier. To do this you first need to change to the directory where you saved the driver file. If you don’t know how to do this check out this guide at Linux Commands.

Once you are there, here’s the code you need to execute:

bash NVIDIA-Linux-x86_64-352.30.run

You should see the line “Verifying archive integrity... OK Uncompressing NVIDIA Accelerated Graphics Driver”

If this completes without an error message then the driver is installed! Congrats!

Almost Done
To be safe, you should also make sure that the X GUI is configured for the new driver. It’s pretty easy, just execute the following:

nvidia-xconfig

Wow, pretty easy huh? There’s just one last thing to attend to and that’s switching the desktop manager we disabled on again:

systemctl enable gdm
ln -s '/usr/lib/systemd/system/gdm.service' '/etc/systemd/system/display-manager.service'
reboot


If all went as planned you should be back in business when the reboot completes!