Create Install NVIDIA driver and cudatoolkit on CentOS 7 authored by Yi Sun's avatar Yi Sun
This instruction is based on CentOS7 and Nvidia driver.
**Preparation**
`yum -y update`
`yum -y groupinstall "Development Tools"`
`yum -y install kernel-devel`
Download the latest NVIDIA driver for unix.
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 machine to make sure running the newest kernel**
Edit `/etc/default/grub`. Append the following to “`GRUB_CMDLINE_LINUX`
`rd.driver.blacklist=nouveau`
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**
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**
## Iinstall NVIDIA’s CUDA Toolkit
Download the latest CUDA Toolkit
**Run the CUDA installer.**
`sh cuda_*.run`
Say no to installing the NVIDIA driver. 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`
Install cuDNN
* download cuDNN
* extract tgz file
sudo cp lib64/\* /usr/local/cuda/lib64/
sudo cp include/\* /usr/local/cuda/include/
sudo reboot
\ No newline at end of file