AlmaLinux 9 10 Now Support NVIDIA GPUs Natively — Here’s How to Set Them Up

AlmaLinux 9 & 10: Unleashing the Power of NVIDIA GPUs with Native Support - A revWhiteShadow Guide
We at revWhiteShadow are excited to announce a significant leap forward for AlmaLinux users who rely on the power of NVIDIA GPUs. With AlmaLinux 9 and 10, the previously complex process of installing and configuring NVIDIA drivers has been streamlined significantly, offering native support that simplifies setup and enhances performance. This guide, brought to you by revWhiteShadow, will walk you through the process of leveraging this native support, enabling you to harness the full potential of your NVIDIA hardware for demanding workloads like machine learning, scientific computing, and high-end graphics applications. We will delve into the prerequisites, installation steps, verification methods, and troubleshooting tips to ensure a smooth and successful experience.
Prerequisites: Preparing Your AlmaLinux System for NVIDIA Acceleration
Before diving into the installation process, it’s crucial to ensure your AlmaLinux system meets the necessary prerequisites. A little preparation can prevent potential headaches down the line and guarantee a smooth integration of NVIDIA drivers.
Verifying Your NVIDIA GPU Compatibility
The first step is to confirm that your NVIDIA GPU is compatible with the available drivers for AlmaLinux 9 and 10. NVIDIA maintains a comprehensive list of supported GPUs on their website. Access the NVIDIA driver download page and filter by your specific card model to ensure compatibility. This prevents installing incompatible drivers, which can lead to system instability and performance issues. Older GPUs might require legacy drivers, which might not be available or fully supported on the latest AlmaLinux releases.
Ensuring Kernel and System Updates are Current
An up-to-date kernel and system packages are essential for a stable and functioning NVIDIA driver installation. Use the following command to update your system:
sudo dnf update -y
This command updates all installed packages to their latest versions, including the kernel. It is important to reboot your system after the update to ensure the new kernel is loaded.
Disabling Nouveau: The Open-Source Driver Conflict
AlmaLinux, by default, utilizes the open-source Nouveau driver for NVIDIA GPUs. This driver, while functional, often lacks the performance and features offered by NVIDIA’s proprietary drivers. To avoid conflicts and ensure proper functionality, Nouveau needs to be disabled. Create a file named /etc/modprobe.d/blacklist-nouveau.conf
with the following content:
blacklist nouveau
options nouveau modeset=0
Next, rebuild the kernel image:
sudo dracut --force
This blacklists the Nouveau driver and prevents it from loading at boot. Reboot your system after this step for the changes to take effect.
Installing Development Tools: Essential for Driver Compilation
Installing the NVIDIA drivers might require compiling kernel modules. Therefore, it’s essential to have the necessary development tools installed. Use the following command to install the required packages:
sudo dnf groupinstall "Development Tools" -y
sudo dnf install kernel-devel kernel-headers -y
This command installs the “Development Tools” group, which includes essential compilers and build tools like GCC and Make, and the kernel-devel
and kernel-headers
packages that correspond to your currently running kernel. This will be necessary if the drivers need to compile against the kernel.
Installing the NVIDIA Drivers on AlmaLinux 9 & 10
With the prerequisites out of the way, we can now proceed with installing the NVIDIA drivers. AlmaLinux offers several methods for installing the drivers, including using the NVIDIA RPM repository or utilizing the ELRepo repository. We recommend using the NVIDIA RPM repository for the most up-to-date drivers and simplified management.
Adding the NVIDIA RPM Repository
The NVIDIA RPM repository provides a streamlined method for installing and updating NVIDIA drivers on AlmaLinux. Add the repository by creating a file /etc/yum.repos.d/nvidia.repo
with the following content:
[nvidia]
name=NVIDIA RPM repository
baseurl=https://developer.download.nvidia.com/compute/cuda/repos/almalinux9/x86_64
enabled=1
gpgcheck=1
gpgkey=https://developer.download.nvidia.com/compute/cuda/repos/almalinux9/x86_64/7fa2af80.pub
[nvidia-local]
name=NVIDIA CUDA Driver local repo
baseurl=file:///var/cuda-repo-almalinux9-x86_64
enabled=0
gpgcheck=1
gpgkey=file:///var/cuda-repo-almalinux9-x86_64/7fa2af80.pub
Note: Replace almalinux9
with almalinux10
if you are using AlmaLinux 10.
Import the GPG key to verify the repository’s authenticity:
sudo rpm --import https://developer.download.nvidia.com/compute/cuda/repos/almalinux9/x86_64/7fa2af80.pub
Note: Again, replace almalinux9
with almalinux10
if you are using AlmaLinux 10.
Installing the NVIDIA Driver Package
Now that the repository is configured, you can install the NVIDIA driver package. Use the following command:
sudo dnf module disable nvidia-driver -y
sudo dnf install nvidia-driver -y
This command installs the latest available NVIDIA driver package from the repository. This command also removes any existing nvidia drivers previously installed on the system. DNF will automatically handle dependencies and install any required packages.
Handling Secure Boot Considerations (if applicable)
If your system is configured with Secure Boot enabled, you might need to sign the NVIDIA kernel modules to allow them to load. This process involves generating a Machine Owner Key (MOK) and using it to sign the modules. After the installation, you may encounter a black screen on boot. The system needs to import the key to be able to boot correctly.
Follow the instructions provided by the NVIDIA driver installation process to generate and enroll the MOK. This usually involves running a command to generate the key and then rebooting the system. During the reboot, you will be prompted to enroll the MOK in the BIOS. Follow the on-screen instructions to complete the enrollment.
Verifying the NVIDIA Driver Installation
After installing the NVIDIA drivers, it’s crucial to verify that they are functioning correctly. This ensures that the drivers have been installed successfully and that your system is properly utilizing your NVIDIA GPU.
Using nvidia-smi
to Check Driver Status
The nvidia-smi
(NVIDIA System Management Interface) utility provides detailed information about your NVIDIA GPU and the installed drivers. Run the following command:
nvidia-smi
This command displays information such as the driver version, CUDA version, GPU utilization, memory usage, and temperature. If the command executes successfully and displays information about your NVIDIA GPU, it indicates that the drivers are installed and functioning correctly.
Checking the Kernel Module Loading
You can also verify that the NVIDIA kernel module is loaded by using the lsmod
command:
lsmod | grep nvidia
This command lists all loaded kernel modules and filters the output to show only modules with “nvidia” in their name. If the NVIDIA kernel module is listed, it confirms that the driver is loaded and active.
Testing with a Simple CUDA Program (Optional)
For users who intend to use CUDA for GPU-accelerated computing, testing with a simple CUDA program can further verify the driver installation. Create a file named deviceQuery.cu
with the following content:
#include <iostream>
#include <cuda_runtime.h>
int main() {
int deviceCount = 0;
cudaError_t error_id = cudaGetDeviceCount(&deviceCount);
if (error_id != cudaSuccess) {
std::cerr << "cudaGetDeviceCount returned " << cudaGetErrorString(error_id)
<< std::endl;
return 1;
}
if (deviceCount == 0) {
std::cout << "There are no available device(s) that support CUDA" << std::endl;
} else {
std::cout << "Detected " << deviceCount << " CUDA Capable device(s)" << std::endl;
}
return 0;
}
Compile the program using the NVIDIA CUDA compiler:
nvcc deviceQuery.cu -o deviceQuery
Run the compiled program:
./deviceQuery
If the program executes successfully and detects your NVIDIA GPU, it confirms that the CUDA toolkit is properly configured and functioning with the installed drivers.
Troubleshooting Common NVIDIA Driver Installation Issues
While the installation process is now simpler with native support, you might still encounter some common issues. Here are some troubleshooting tips to help resolve them:
Black Screen After Reboot
A black screen after reboot often indicates an issue with the graphics driver or Secure Boot. Ensure that you have correctly disabled Nouveau and, if Secure Boot is enabled, that you have properly enrolled the MOK. Double-check the Secure Boot settings in your BIOS and ensure that the MOK is trusted.
Driver Installation Errors
Driver installation errors can occur due to various reasons, such as conflicting packages or incomplete dependencies. Ensure that you have updated your system to the latest version and that you have installed all the necessary development tools. Review the error messages carefully and search for solutions online or consult the NVIDIA documentation.
nvidia-smi
Not Found
If the nvidia-smi
command is not found, it usually indicates that the NVIDIA driver installation is incomplete or that the system’s PATH environment variable is not properly configured. Ensure that the NVIDIA driver packages are installed correctly and that the /usr/bin
and /usr/local/bin
directories are included in your PATH variable.
Performance Issues
If you experience performance issues after installing the NVIDIA drivers, it could be due to various factors, such as incorrect driver settings or insufficient system resources. Ensure that you have selected the correct performance profile in the NVIDIA X Server Settings utility and that your system meets the minimum requirements for your workload. Check GPU temperature using nvidia-smi
command to avoid GPU throttling issues.
Optimizing NVIDIA GPU Performance on AlmaLinux
Once the NVIDIA drivers are installed and verified, you can further optimize the performance of your NVIDIA GPU for specific workloads. The NVIDIA X Server Settings utility provides various options for configuring the driver settings and maximizing performance.
Configuring PowerMizer Settings
The PowerMizer settings allow you to control the power consumption and performance of your NVIDIA GPU. You can choose between different power modes, such as “Adaptive,” “Maximum Performance,” and “Optimal Power.” For demanding workloads, selecting “Maximum Performance” can provide a significant performance boost.
Enabling GPU Acceleration for Applications
Many applications, such as video editors and scientific computing software, can leverage GPU acceleration to improve performance. Ensure that GPU acceleration is enabled in the application’s settings and that the application is properly configured to utilize your NVIDIA GPU. CUDA programs need to be compiled correctly and linked against the CUDA libraries to be able to run on the NVIDIA GPU.
Monitoring GPU Usage and Temperature
Monitoring GPU usage and temperature can help you identify potential bottlenecks and optimize your system configuration. Use the nvidia-smi
command or the NVIDIA X Server Settings utility to monitor GPU usage and temperature in real-time. This can also prevent overheating, which can result in GPU throttling.
Conclusion: Embracing NVIDIA Power on AlmaLinux
We at revWhiteShadow hope that this comprehensive guide has equipped you with the knowledge and tools to successfully install and configure NVIDIA drivers on AlmaLinux 9 and 10. With native support, the process has become significantly simpler, allowing you to unlock the full potential of your NVIDIA GPUs for a wide range of demanding applications. By following these steps and troubleshooting tips, you can ensure a smooth and seamless experience and harness the power of NVIDIA acceleration on your AlmaLinux system. We are committed to providing you with the latest information and best practices to help you maximize your computing experience. This article should help you to get NVIDIA GPU working efficiently on AlmaLinux 9 and 10. With the help of this, users can enjoy the performance of their GPUs and make the most out of it.