Source

This debian wiki is the reference and you MUST read it ! . and also if you want to use CUDA for Tensorflow you MUST read it's documentation .

Nvidia driver installation

1. Ensure Non-Free Repositories Are Enabled

Your /etc/apt/sources.list already includes contrib, non-free, and non-free-firmware. No changes are needed.

2. Update the System

Update the package lists:

sudo apt update

3. Install Prerequisites

Install the required tools:

sudo apt install dkms build-essential linux-headers-$(uname -r)

4. Install the NVIDIA Driver

Install the driver package:

sudo apt install nvidia-driver

5. Verify the Installation

Reboot the system:

sudo systemctl reboot

After reboot, check the GPU status:

nvidia-smi

6. Optional: Install CUDA Toolkit

If you need CUDA support (e.g., for AI development):

sudo apt install nvidia-cuda-toolkit

7. Blacklist Nouveau (if necessary)

If you encounter issues with the Nouveau driver, create a configuration file:

sudo nano /etc/modprobe.d/blacklist-nouveau.conf

Add the following:

blacklist nouveau options nouveau modeset=0

Update the initramfs and reboot:

sudo update-initramfs -u sudo reboot