---
# System prepended metadata

title: Install NVIDIA cuda driver on Rhel7
tags: [Redhat]

---

---
tags: Redhat
---
# Install NVIDIA cuda driver on Rhel7
###### tags: `RHEL`

## HW Equipment 
Hardware System: SCB1921
OS: RHEL7.9
GPU: NVIDIA Tesla T4

## SOP
download .run installing driver file at: https://www.nvidia.com/Download/index.aspx?lang=en-us

### update the Grub file with this
```javascript=
GRUB_CMDLINE_LINUX="rd.driver.blacklist=nouveau nouveau.modeset=0"

```
create a file: 
```javascript=
# sudo vim /etc/modprobe.d/blacklist-nouveau.conf
# grub2-mkconfig -o /boot/grub2/grub.cfg
```

in blacklist-nouveau.conf
```javascript=
blacklist nouveau
options nouveau modeset=0
```
save the file and exit

Then: 
```javascript=
# dracut --force --add multipath --include /etc/multipath
# sudo reboot
```
After restarting, we can use the following command to confirm whether Nouveau has stopped working:
```javascript=
# lsmod | grep nouveau
```
If nothing is printed, then congratulations! You have disabled Nouveau's kernel driver. Now we can try again to see if we can install Nvidia's official driver!

make it excutable 
```javascript=
$ chmod +x NVIDIA-Linux-x86_64-460.32.03.run //make it executable
```
installing nvidia driver
```javascript=
$ ./NVIDIA-Linux-x86_64-460.32.03.run //name of file may be different, depends on the version which you download from
```

in .run, there're some warnings, just choose continue installing item and finish the installing procedure

### While Installtion using GUI if you face this error then follow this:
### you appear to be running an X server please exit X before installing
```javascript=
open terminal 

# sudo init 3
# rm -r /tmp/.X*
```
dnf installation
```javascript=
yum install dnf
```
now install kernel-headers & kernel-devel
```javascript=
# dnf groupinstall "Development Tools"
# dnf install kernel-headers
# dnf install kernel-devel
# uname -a
"Linux sandbox 4.18.0-80.11.2.el8_0.x86_64 #1 SMP Tue Sep 24 11:32:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux"
# rpm -qa | grep -E "kernel-devel|kernel-headers"
"kernel-headers-4.18.0-80.11.2.el8_0.x86_64"
"kernel-devel-4.18.0-80.11.2.el8_0.x86_64"
# dnf distro-sync
# reboot
```
Again go to CLI mode
```javascript=
open terminal 

# sudo init 3
```
Go to the Downlaods folder where we download the driver.
```javascript=
cd /home/aewin/Downloads
```
Run the NVIDIA driver file again
```javascript=
./NVIDIA-Linux-x86_64-460.32.03.run //name of file may be different, depends on the version which you download from
```
after reboot, press nvidia-smi to see the driver is OK or not

```javascript=
$ nvidia-smi
```


### If the Virt-Manager is keep on Connecting state.
```javascript=
# systemctl start libvirtd.service
```



## source: 
1. https://clay-atlas.com/blog/2020/02/11/linux-chinese-note-nvidia-driver-nouveau-kernel/
2. https://askubuntu.com/questions/841876/how-to-disable-nouveau-kernel-driver