When it comes to graphics drivers for NVIDIA video cards, there are two main options: the proprietary/open-source NVIDIA drivers or the open-source Nouveau drivers. Most importantly, the Nouveau drivers are perfectly acceptable; however, if you use your Linux system for activities requiring high-performance graphics, you may want to consider using the official NVIDIA drivers. The Nouveau drivers are community-created and -supported drivers that are available free of charge; however, they may not offer the same level of performance as the NVIDIA drivers. Ultimately, deciding which driver to use depends on your needs and preferences.
The following tutorial will teach you how to install the NVIDIA drivers on CentOS 9 Stream using the command line terminal with alternative installation methods of RPM Fusion or the NVIDIA Cuda Repository.
Table of Contents
Update CentOS Stream
Before you begin, update your system to ensure all existing packages are up to date to avoid conflicts during the installation.
sudo dnf upgrade --refresh -y
Determine your Graphics Card
The first step for users with aging NVIDIA Graphics cards is to determine what it is and if it is supported, users with brand new cards can skip this part as there is no doubt they will be supported.
First, find your graphics card module.
lspci | grep -e VGA
03:00.0 VGA compatible controller: NVIDIA Corporation TU117 [GeForce GTX 1650] (rev a1)
If you are using an old card, I advise you to research it on the NVIDIA website; if the latest NVIDIA drivers still support it, you may need to install legacy drivers.
Install EPEL/EPEL Next Repository (Required)
The first task is to install the EPEL repository, and the recommendation is to install both repositories.
First, enable the CRB repository.
sudo dnf config-manager --set-enabled crb
Next, install EPEL using the following (dnf) terminal command.
sudo dnf install \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \ https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm
Install NVIDIA Drivers – NVIDIA Repository Method
WARNING, X86_64 ARCHITECTURE IS ONLY SUPPORTED IN THIS METHOD FROM NVIDIA.
The second method is installing the NVIDIA drivers directory from the source. This can be beneficial, along with the ability to grab updates as soon as they appear. Beta drivers are also available in this repository, making it possibly more appealing than using RPM Fusion.
First, import the repository for your system.
sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel9/$(uname -i)/cuda-rhel9.repo
Install required dependencies for safe measures.
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
Next, install the latest NVIDIA drivers.
sudo dnf module install nvidia-driver:latest-dkms
Note you will be prompted to import GPG keys during the installation. This is safe to do so for newer users, type Y when prompted.
Alternatively, you can list the modules of Nvidia RPM using the following command.
sudo dnf module list nvidia-driver
For open-source users, you can install this module instead of the proprietary, and I suggest keeping the latest. However, as mentioned above, this is still new, so issues may be encountered possibly slightly more, but this should be rare. Any problems, install the non-open source.
sudo dnf module install nvidia-driver:open-dkms
Lastly, reboot your system once done.
Verify the installation by running NVIDIA-SMI as the manual installation steps showed beforehand.
Alternatively, you can open the NVIDIA settings GUI from your application icon menu or use the following command.
As mentioned above, at the time of the tutorial, NVIDIA 520 is the latest, which you can see is installed due to the fact we are installing directly from the NVIDIA repository; in the future, this version will change pretty quickly as the tutorial ages.
Slow Boot Times with Nvidia Drivers
A common complaint when installing Nvidia drivers is the slow boot time. This is mainly caused due to Nvidia, with the kernel searching for USB-C drivers that support VR devices.
Depending on your system setup, the following methods may work to fix it.
Blacklist the USB-C driver by opening the following “/etc/sysconfig/grub” location.
Find the line with “GRUB_CMDLINE_LINUX=” and add the following as the last entry under it.
grub2-mkconfig -o /boot/grub2/grub.cfg
Then reboot your system.
Blacklist the USB-C driver
sudo echo "blacklist i2c_nvidia_gpu" >> /etc/modprobe.d/blacklist_i2c-nvidia-gpu.conf
sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
Then reboot your system.
Comments and Conclusion
The NVIDIA repository is the go-to if you want a more powerful graphics card and drivers. Installing these drivers can be a bit daunting for new Linux users, but the reward is worth it for better performance.