How To Install Nvidia Drivers on Rocky Linux 10
In this tutorial, we will show you how to install Nvidia Drivers on Rocky Linux 10. Installing NVIDIA drivers on Rocky Linux can significantly enhance your system’s graphics performance, whether you’re using your machine for gaming, machine learning, video editing, or cryptocurrency mining. Rocky Linux 10, as an enterprise-grade Linux distribution, provides excellent compatibility with NVIDIA’s proprietary drivers when properly configured.
This comprehensive guide walks you through multiple installation methods, system preparation, troubleshooting common issues, and post-installation optimization. By following these detailed instructions, you’ll have your NVIDIA GPU running smoothly with the latest drivers in no time.
Prerequisites and System Requirements
Before diving into the NVIDIA driver installation process, ensure your system meets the necessary requirements and you have the proper access permissions.
Hardware Requirements
Your system must have a compatible NVIDIA GPU installed. Most modern NVIDIA graphics cards are supported, including GeForce, Quadro, and Tesla series cards. To check your GPU compatibility, run the following command:
lshw -c display
This command displays detailed information about your graphics hardware, including the specific GPU model and vendor.
Software Prerequisites
You’ll need a fresh Rocky Linux 10 installation with administrative privileges. Ensure you have:
- Rocky Linux 10 (desktop or server installation)
- Sudo access to execute administrative commands
- Active internet connection for downloading packages
- Basic familiarity with command-line operations
Pre-Installation System Check
Before proceeding with the driver installation, verify your current system status. Check your kernel version using:
uname -r
Ensure your system is fully updated by running:
sudo dnf update -y
Understanding Installation Methods
Rocky Linux 10 offers several approaches for installing NVIDIA drivers, each with distinct advantages and use cases.
Official NVIDIA Repository Method (Recommended)
The official NVIDIA repository method provides the most reliable installation experience. This approach offers automatic updates, proper dependency management, and seamless integration with Rocky Linux’s package management system. NVIDIA maintains these repositories specifically for Red Hat-based distributions, ensuring optimal compatibility.
Alternative Installation Methods
While less common, alternative methods include RPMFusion repositories and ELRepo drivers. RPMFusion works particularly well for older hardware configurations. However, avoid using NVIDIA’s .run installer, as it’s notorious for overwriting system files and causing compatibility issues.
System Preparation
Proper system preparation is crucial for successful NVIDIA driver installation. This section covers all necessary dependencies and configurations.
Installing Essential Development Tools
First, enable the Extra Packages for Enterprise Linux (EPEL) repository, which provides additional packages not included in the standard Rocky Linux repositories:
sudo dnf install epel-release -y
Next, install the Development Tools group package, which includes essential build dependencies:
sudo dnf groupinstall "Development Tools" -y
Kernel Preparation
Install kernel development packages that provide necessary headers and tools for building kernel modules:
sudo dnf install kernel-devel -y
For additional compatibility, install kernel headers matching your current kernel version:
sudo dnf install kernel-headers-$(uname -r) -y
Installing Dynamic Kernel Module Support (DKMS)
DKMS automatically rebuilds kernel modules when kernel updates occur, ensuring your NVIDIA drivers remain functional after system updates:
sudo dnf install dkms -y
Additional Dependencies
Install comprehensive dependencies required for NVIDIA driver compilation and operation:
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 pkgconf dkms -y
Installing NVIDIA Drivers – Official Repository Method
The official NVIDIA repository provides the most straightforward and reliable installation path for Rocky Linux 10 users.
Adding NVIDIA Official Repository
Add the official NVIDIA CUDA repository to your system. For Rocky Linux 10, use the RHEL 9 compatible repository:
sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel9/$(uname -i)/cuda-rhel9.repo
Update your package cache to recognize the new repository:
sudo dnf makecache
Installing Required Dependencies
Before installing the actual NVIDIA drivers, ensure all necessary dependencies are present:
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 -y
Driver Installation Process
Install the latest NVIDIA driver module with DKMS support:
sudo dnf module install nvidia-driver:latest-dkms -y
The DKMS version automatically handles kernel module recompilation during future kernel updates, providing long-term stability.
Optional CUDA Installation
For users requiring CUDA support for machine learning, scientific computing, or development work, install additional CUDA libraries:
sudo dnf install freeglut-devel libX11-devel libXi-devel libXmu-devel make mesa-libGLU-devel freeimage-devel libglfw3-devel -y
Disabling Nouveau Drivers
Nouveau is the open-source NVIDIA driver that provides limited functionality compared to NVIDIA’s proprietary drivers. Disabling it prevents driver conflicts and ensures optimal performance.
Understanding Nouveau vs. Proprietary Drivers
Nouveau drivers offer basic functionality but lack advanced features like CUDA support, optimal gaming performance, and professional workstation capabilities. The proprietary NVIDIA drivers provide complete feature sets and better performance optimization.
Blacklisting Nouveau Drivers
Use the grubby command to modify kernel parameters and blacklist Nouveau drivers:
sudo grubby --args="nouveau.modeset=0 rd.driver.blacklist=nouveau" --update-kernel=ALL
This command adds kernel boot parameters that prevent Nouveau from loading during system startup.
Alternative Blacklisting Method
For additional security, create a blacklist configuration file:
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
echo 'omit_drivers+=" nouveau "' | sudo tee /etc/dracut.conf.d/blacklist-nouveau.conf
Regenerate the initial RAM filesystem:
sudo dracut --regenerate-all --force
sudo depmod -a
Secure Boot and MOK Enrollment
Systems with Secure Boot enabled require additional configuration steps to load unsigned kernel modules.
MOK Enrollment Process
For Secure Boot systems, enroll the Machine Owner Key (MOK):
sudo mokutil --import /var/lib/dkms/mok.pub
The system will prompt you to create a password for MOK enrollment. Remember this password as you’ll need it during the next reboot.
Post-Reboot MOK Configuration
After rebooting, your system will display a MOK management screen. Select “Enroll MOK” and enter the password you created in the previous step. This process allows your system to load the NVIDIA kernel modules despite Secure Boot being enabled.
System Configuration and Reboot
Complete the installation process by finalizing system configurations.
Finalizing Driver Configuration
Ensure all changes are written to the bootloader configuration:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
For UEFI systems, use:
sudo grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg
System Reboot Process
Reboot your system to load the new NVIDIA drivers:
sudo reboot now
During the first boot with new drivers, the system may take slightly longer to start as it initializes the NVIDIA modules.
Verification and Testing
After rebooting, verify that your NVIDIA drivers are properly installed and functioning.
Basic Driver Verification
Use the nvidia-smi command to verify successful installation:
nvidia-smi
This command displays comprehensive GPU information, including driver version, GPU utilization, memory usage, and temperature. A successful installation shows your GPU details and current status.
GUI Verification Methods
For desktop installations, launch the NVIDIA X Server Settings application:
nvidia-settings
This graphical interface provides detailed configuration options and confirms proper driver installation through its user-friendly interface.
Advanced Verification Tests
Test OpenGL functionality:
glxinfo | grep "OpenGL version"
For CUDA-enabled installations, verify CUDA functionality:
nvcc --version
Troubleshooting Common Issues
Even with careful preparation, you might encounter installation challenges. Here are solutions to common problems.
Driver Installation Failures
If kernel module compilation fails, ensure all development tools are properly installed:
sudo dnf groupinstall "Development Tools" -y
sudo dnf install kernel-devel-$(uname -r) kernel-headers-$(uname -r) -y
Post-Installation Problems
If nvidia-smi returns “command not found,” verify the driver installation:
sudo dnf list installed | grep nvidia
For display issues or black screens, check your X11 configuration and ensure proper integration with your display manager.
Secure Boot Related Issues
MOK enrollment failures often result from incorrect password entry or timing issues during boot. Repeat the MOK enrollment process if necessary:
sudo mokutil --import /var/lib/dkms/mok.pub
System Update Conflicts
DKMS automatically rebuilds drivers during kernel updates. If issues arise, manually trigger rebuilding:
sudo dkms autoinstall
Advanced Configuration and Optimization
Maximize your NVIDIA GPU performance through advanced configuration options.
NVIDIA Control Panel Configuration
Access advanced GPU settings through nvidia-settings. Configure performance modes, adjust fan curves, and optimize power management settings based on your specific use case.
CUDA Development Environment
For developers requiring CUDA support, set proper environment variables:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
Power Management Optimization
Configure GPU power states for optimal performance or power efficiency:
sudo nvidia-smi -pm 1
This command enables persistent mode, maintaining GPU settings across applications.
Maintenance and Updates
Maintain your NVIDIA driver installation for optimal long-term performance.
Keeping Drivers Updated
NVIDIA drivers receive regular updates through the official repository. Update your drivers using standard system update procedures:
sudo dnf update
System Maintenance Best Practices
Regularly monitor driver stability using nvidia-smi and system logs. Keep your kernel and system packages updated to maintain compatibility with NVIDIA drivers.
Backup and Recovery Strategies
Before major system updates, create system snapshots or backups. This precaution allows quick recovery if driver conflicts arise during updates.
Alternative Installation Methods
While the official repository method is recommended, alternative approaches exist for specific scenarios.
RPMFusion Installation Method
RPMFusion provides community-maintained NVIDIA drivers, particularly useful for older hardware:
sudo dnf install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm
sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda
Legacy Hardware Considerations
Older NVIDIA GPUs may require legacy driver versions. Check NVIDIA’s legacy driver database to determine appropriate driver versions for your hardware.
Performance Optimization Tips
Maximize your NVIDIA GPU performance through these optimization techniques.
Driver Configuration Tuning
Use nvidia-settings to configure performance profiles, adjust memory clocks, and optimize power management settings based on your workload requirements.
System Integration
Ensure proper integration with your desktop environment and applications. Configure OpenGL settings for optimal compatibility with graphics-intensive applications.
Monitoring and Diagnostics
Regularly monitor GPU performance using nvidia-smi, system monitoring tools, and application-specific benchmarks to identify potential issues or optimization opportunities.
Congratulations! You have successfully installed Nvidia Drivers. Thanks for using this tutorial for installing Nvidia Drivers on your Rocky Linux 10 system. For additional help or useful information, we recommend you check the official Nvidia website.