How to Install NVIDIA Drivers on AlmaLinux 8
If you’re sick of the blocky graphics and laggy games that come with the default Nouveau driver, this guide shows you how to replace it with Nvidia’s official Linux driver on AlmaLinux 8. You’ll get hardware‑accelerated OpenGL, CUDA support, and a smoother desktop experience without having to reinstall the whole OS.
Prep: Disable Secure Boot (if it’s enabled)
Secure Boot blocks unsigned kernel modules – the Nvidia .ko files are signed by Nvidia, not by your distro. If you leave it on, the driver won’t load and you’ll end up with a black screen after reboot.
- Reboot and hit F2 or Del (your motherboard’s key) to enter the firmware UI.
- Find the Secure Boot toggle under “Boot” or “Security” and set it to Disabled.
- Save changes and exit.
Add the ELRepo repository
ELRepo supplies the kernel‑headers and dkms packages that keep third‑party modules in sync with AlmaLinux’s rolling kernel updates. Skipping this step means you’ll have to manually rebuild the driver after every kernel upgrade.
sudo dnf install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
The command pulls a small RPM that adds the repo file under /etc/yum.repos.d/.
Install the kernel development files
Nvidia’s installer needs the exact headers for the running kernel. If you’re on a newer kernel than the one shipped with AlmaLinux, ELRepo will provide the matching kernel-ml-devel package.
sudo dnf install kernel-ml-devel akmod-nvidia
Why this matters: akmod-nvidia creates an automatic DKMS build whenever the kernel changes, so you won’t be left stranded after a routine update.
Blacklist Nouveau
Even with Nvidia installed, the system may still try to load Nouveau first, which can cause conflicts. Create a blacklist file and rebuild the initramfs.
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
sudo dracut -f
The dracut command rewrites the initial RAM disk to exclude Nouveau, ensuring the Nvidia module gets a clean load path.
Install the proprietary driver
Now pull in the actual driver package. ELRepo maintains a pre‑built binary that matches most recent GPUs.
sudo dnf install nvidia-driver akmod-nvidia
akmod-nvidia will compile the kernel module on first boot if needed.
Real‑world note
I ran into a nasty freeze after a driver update because I forgot to reinstall kernel-ml-devel. The system booted to a tty, and modprobe nvidia failed with “invalid module format”. Reinstalling the devel package solved it instantly.
Reboot and verify
A reboot is required for the new kernel module to load. After logging back in:
nvidia-smi
If you see a table showing your GPU, driver version, and memory usage, you’re good to go.
You can also check Xorg’s logs (/var/log/Xorg.0.log) for lines mentioning NVIDIA to confirm the X server is using the right driver.
Optional: Enable CUDA (if you need it)
For compute workloads, install the CUDA toolkit:
sudo dnf install cuda-toolkit
That pulls in the libraries and sample code, letting you compile with nvcc.
That’s it – Nvidia should now be running its own driver stack on AlmaLinux 8. If something goes sideways, drop a line in the comments; I’ve spent enough time wrestling with kernel‑module mismatches to know the usual culprits.