CentOS 7.x Install nvidia drivers and cuda library
From Notes_Wiki
Home > CentOS > CentOS 7.x > System Administration > Package management > CentOS 7.x Install nvidia drivers and cuda library
To install Nvidia drivers and Cuda library on CentOS 7.x use:
- Do full installation of CentOS7
- Disable Selinux by editing '/etc/selinux/config' and using:
- SELINUX=disabled
- Also do
- setenforce 0
- Disable firewalld
- systemctl stop firewalld
- systemctl disable firewalld
- Install EPEL & DKMS
- yum install epel-release -y
- yum install kernel-devel epel-release dkms
- Full update
- yum update -y
- In CentOS7, Default there is no xorg.conf file. Take backup if you found.
- cd /etc/X11/
- cp xorg.conf original-xorg-conf
- In CentOS7, NVIDIA card uses NOUVEAU open source driver. Check with below command
- lshw -numeric -C display
- Diable this open source driver at kernel level by editing '/etc/default/grub' with:
- GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet nouveau.modeset=0"
- Apply new GRUB configuration using
- grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
- On non-EFI systems above command could be:
- grub2-mkconfig -o /boot/grub2/grub.cfg
- Reboot the and make sure GUI works properly
- shutdown -r now
- Verify NVIDIA card not using nouveau driver
- lshw -numeric -C display
- Download the gpu card drivers repo file for compatible OS from https://www.nvidia.com/Download/index.aspx?lang=en-us
- Install the downloaded repo
- yum -y localinstall nvidia-driver-local-repo-rhel7-515.48.07-1.0-1.x86_64.rpm
- Change to run level 3
- systemctl isolate multi-user.target
- Install the cuda drivers
- yum install nvidia-kmod cuda-drivers
- If any nvidia.conf files in /etc/X11/ or /etc/X11/xorg.conf.d/, comment all the lines.
- Remove any xorg.conf file. No need to create any xorg.conf file with busid
- Reboot the gpu node
- shutdown -r now
- Check the gpu card status using:
- nvidia-smi
- If you able to execute the above command and able to see the nvidia card details, then drivers were installed properly.
- Download correct version of CUDA repo rpm file from https://developer.nvidia.com/cuda-downloads
- Install cuda using:
- yum localinstall cuda-repo-rhel7-10-0-local-10.0.130-410.48-1.0-1.x86_64.rpm
- yum install cuda
- In case of gpg errors we can use 'yum -y --nogpgcheck install cuda' as cuda-sanitizer package is perhaps not signed properly via the key.
- Check cuda version using:
- ls /usr/local/cuda*
- Export system path to Nvidia CUDA binary executables by editing '/etc/bashrc' with:
- export PATH=/usr/local/cuda-<ver>/bin${PATH:+:${PATH}}
- export LD_LIBRARY_PATH=/usr/local/cuda-<ver>/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
- Read updated bashrc file in current shell using:
- source /etc/bashrc
- ldconfig
- Check cuda version details with the below command
- nvcc --version
Home > CentOS > CentOS 7.x > System Administration > Package management > CentOS 7.x Install nvidia drivers and cuda library