How to install the NVIDIA proprietary driver on AlmaLinux and CentOS

Download the latest GPU driver from the NVIDIA driver download page.

  • Make the driver file that you have just downloaded executable by entering the following command.

chmod +x /root/NVIDIA-${version}.sh

  • Disable the nouveau module;

echo 'blacklist nouveau' >> /etc/modprobe.d/blacklist.conf

  • Install dependencies by replacing the server with GUI to the workstation.

dnf groupinstall "Server with GUI" "base-x" "Legacy X Window System Compatibility" "Development Tools"

dnf install elfutils-libelf-devel "kernel-devel-uname-r == $(uname -r)"

  • Take a backup of initramfs filesystem and rebuild it;

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img

dracut --force

  • Change runlevel to text mode.

systemctl set-default multi-user.target

  • Reboot server.
  • Install the NVIDIA driver you downloaded in the first step of this How-To.

/root/NVIDIA-${version}.run

  • If your GPU is not supported by AlmaLinux, you may need to set the nomodeset option in GRUB during the installation phase. Remove nomodeset option and rebuild GRUB as follows.
  • For BIOS mode servers;

grub2-mkconfig -o /boot/grub2/grub.cfg

  • For EFI based servers;

grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg

  • Reboot the server with the reboot command.
  • To test the new GPU driver switch to the GUI level.

systemctl isolate graphical.target

  • In case of testing is correct, change the default runlevel to GUI.

systemctl set-default graphical.target

Leave a Reply