Expand your knowledge of hardware, software and supercomputing

Installing NVIDIA Drivers on RHEL or CentOS 7

Most users of NVIDIA graphics cards prefer to use the drivers provided by NVIDIA. These more fully support the capabilities of the card when compared to the nouveau driver that is included with the distribution. These are the steps to install the NVIDIA driver and disable the nouveau driver.

Prepare your machine

yum -y update
yum -y groupinstall "GNOME Desktop" "Development Tools"
yum -y install kernel-devel

Download the latest NVIDIA driver for unix.
==> http://www.nvidia.com/object/unix.html ==> Latest Long Lived Branch version
Note: If using a recently released, top end GTX or Tesla you may get more support with the Latest Short Lived Branch instead.

In order to have the NVIDIA drivers rebuilt automatically with future kernel updates you can also install the EPEL repository and the DKMS package. This is optional.

yum -y install epel-release
yum -y install dkms

Reboot your machine to make sure you are running the newest kernel

Edit /etc/default/grub. Append the following  to “GRUB_CMDLINE_LINUX
rd.driver.blacklist=nouveau nouveau.modeset=0

Generate a new grub configuration to include the above changes.
grub2-mkconfig -o /boot/grub2/grub.cfg

Edit/create /etc/modprobe.d/blacklist.conf and append:
blacklist nouveau

Backup your old initramfs and then build a new one
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
dracut /boot/initramfs-$(uname -r).img $(uname -r)

Reboot your machine

If your machine doesn’t boot to a login prompt disconnect your monitor from the graphics card and plug directly into the onboard VGA port. Alternatively SSH directly into the machine.

The NVIDIA installer will not run while X is running so switch to text mode:
systemctl isolate multi-user.target

Run the NVIDIA driver installer and enter yes to all options.
sh NVIDIA-Linux-x86_64-*.run

Reboot your machine

Optionally install NVIDIA’s CUDA Toolkit

Download the latest CUDA Toolkit (runfile installer option, not the rpm download)
==> https://developer.nvidia.com/cuda-downloads ==> Linux ==> x86_64 ==> RHEL/CentOS ==> 7 ==> runfile (local)

Run the CUDA installer.
sh cuda_*.run
Say no to installing the NVIDIA driver. The standalone driver you already installed is typically newer than what is packaged with CUDA. Use the default option for all other choices.

To add CUDA to your environment add the following files.

Create /etc/profile.d/cuda.sh
PATH=$PATH:/usr/local/cuda/bin
export PATH

Create /etc/profile.d/cuda.csh
set path = ( $path /usr/local/cuda/bin )

Create /etc/ld.so.conf.d/cuda.conf
/usr/local/cuda/lib64

Use our Breakin stress test and diagnostics tool to pinpoint hardware issues and component failures.
Check out our product catalog and use our Configurator to plan your next system and get a price estimate.

Request a Consultation from our team of HPC and AI Experts

Would you like to speak to one of our HPC or AI experts? We are here to help you. Submit your details, and we'll be in touch shortly.

  • This field is for validation purposes and should be left unchanged.