# How to Install NVIDIA Driver and CUDA on Rocky 9.1

**URL:** <https://forums.rockylinux.org/t/how-to-install-nvidia-driver-and-cuda-on-rocky-9-1/9686>\
**Category:** Rocky Linux Help & Support\
**Created:** [April 24, 2023, 1:49pm UTC](https://forums.rockylinux.org/t/how-to-install-nvidia-driver-and-cuda-on-rocky-9-1/9686 "2023-04-24T13:49:46Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![timppu](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@timppu](https://forums.rockylinux.org/u/timppu)\
**Post date:** [May 14, 2023, 9:17pm UTC](https://forums.rockylinux.org/t/how-to-install-nvidia-driver-and-cuda-on-rocky-9-1/9686/11 "2023-05-14T21:17:56Z")

</div>

I actually found instructions that seem to be working, without having to disable Secure Boot:

[https://www.reddit.com/r/RockyLinux/comments/woqgij/rocky\_9\_nvidia\_drivers\_secure\_boot\_success/](https://www.reddit.com/r/RockyLinux/comments/woqgij/rocky_9_nvidia_drivers_secure_boot_success/)

I changed the instructions a bit, e.g. the non-working “sudo echo \>” commands in the original instructions:

```auto
sudo dnf install epel-release 
sudo dnf upgrade
sudo reboot

```

After the reboot:

```auto
sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel9/$(uname -i)/cuda-rhel9.repo
sudo dnf install kernel-headers-$(uname -r) kernel-devel-$(uname -r) tar bzip2 make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-opengl libglvnd-glx libglvnd-devel acpid pkgconfig dkms
sudo dnf module install nvidia-driver:latest-dkms
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
echo 'omit_drivers+=" nouveau "' | sudo tee /etc/dracut.conf.d/blacklist-nouveau.conf
sudo dracut --regenerate-all --force
sudo depmod -a

```

The mokutil command will prompt for you to make up a password, which will be used during reboot

```auto
sudo mokutil --import /var/lib/dkms/mok.pub
sudo reboot

```

After the reboot, your system should ask you if you want to enroll a key or something like that, say yes and it asks for the password you gave in the mokutil command.

Later on, check that the nvidia drivers are installed:

`nvidia-smi`

If you dual boot windows, a windows-driven firmware update may reset the TPM chip (?). Anyway, any time this happens you’ll need to re-run ‘mokutil --import /var/lib/dkms/mok.pub’

---

_[View the full topic](https://forums.rockylinux.org/t/how-to-install-nvidia-driver-and-cuda-on-rocky-9-1/9686)._
