Simple instructions on how to install nVidia drivers for X11 on Debian written by Len Sorensen. (LSorensen on irc.debian.org, lsorense -at- csclub.uwaterloo.ca, http://www.tinyplanet.ca/~lsorense/)

Last updated May 09, 2011.
Feel free to email reports on this information working or not working and any suggestions you have on making it better.

At this time these are the Debian versions:
SqueezeDebian 6.0 stable release
WheezyDebian testing release (will be next stable release when done)
SidDebian unstable (will never be released, but provides packages for testing after they have been tested for a while.)

Step 0: Cleaning up the mess from nvidia's installer (if you used it first):
Make sure to remove all the garbage created by the nvidia installer, since it places files in different locations, and may cause problems even after following these instructions. It is supposed to have an uninstall option. Something like: nvidia-installer --uninstall should do it. I have not used it myself, since doing it this way is so simple and works very well, and of course: It is `The Debian Way'. The --uninstall option should remove everything it installed (At least I hope so.)
Do NOT try to mix and match with the debian packages and the nvidia installer. They do not get along, they don't agree on where files should go or how just about anything should be done. It's one way or the other. To do it right the Debian way, all traces of the nvidia installer has to go. In fact the nvidia installer doesn't agree with where Debian installs files.

Step 1: Preparing your package sources
Ensure you have main contrib non-free in your /etc/apt/sources.list since the nvidia drivers are in non-free and some of the helpers are in contrib.

Step 2: Ensure your kernel is the right version.

Please make sure you are running an up to date kernel so that the headers matching it can be installed.
For i386 any intel chip would be 686 unless it is a really old pentium or 486 in which case you use 486. An AMD system would be 686 for Athlon and for K6 and older use 486.
CPU TypeCommand
i386: 486, Pentium, K5, K6, etc.apt-get install linux-image-2.6-486 linux-headers-2.6-486
i386: Athlon, Pentium Pro, P2, P3, P4, etc.apt-get install linux-image-2.6-686 linux-headers-2.6-686
amd64: Any AMD or Intelapt-get install linux-image-2.6-amd64 linux-headers-2.6-amd64
If you have more than 3GB ram and are running i386, you want the 686-bigmem kernel instead (or 686-pae if using Wheezy or newer).
That will keep you running the latest kernel released by Debian. If the command to install linux-headers fails later, you didn't do this step right.
Remember to reboot after installing a new kernel so that you are running the right one. If you already had the current kernel, you can just continue.

Step 3: Installing needed packages for building the nvidia kernel module.
Install a few packages needed:
apt-get install nvidia-kernel-dkms

NOTE: If you are using an older nvidia chip you may have to use a legacy driver instead of the current one.

On Squeeze the current driver supports at least all geforce 6xxx series cards up through most 2xx series, some 3xx series, and the 470 and 480 as far as I know. Unstable supports some 5xx cards and all 4xx as far as I know. (currently unstable uses version 270.41.06 as of this writing)

Geforce 5xxx and older require the 173xx legacy driver, Geforce 4 and older require a 96xx legacy driver, and Geforce 2 (but not 2 MX or other integrated video chips) require the 71xx legacy driver which no longer exists so they are out of luck.

Replace nvidia-glx, nvidia-glx-dev and nvidia-kernel-dkms like this in all the following instructions:
Chip Generationnvidia-glxnvidia-glx-devnvidia-kernel-dkms
Geforce 2 and older (like TNT)nvidia-glx-legacy-71xx (dead)nvidia-glx-legacy-71xx-dev (dead)nvidia-kernel-legacy-71xx (dead)
Geforce 4 and older (including 2 MX)nvidia-glx-legacy-96xxnvidia-glx-legacy-96xx-devnvidia-kernel-legacy-96xx
Geforce FX 5xxxnvidia-glx-legacy-173xxnvidia-glx-legacy-173xx-devnvidia-kernel-legacy-173xx
Geforce FX 6xxx and newernvidia-glxnvidia-glx-devnvidia-kernel
The newer drivers may not support systems without SSE, but since only AGP and PCI systems don't have SSE, the 96xx driver should be sufficient since it covers all AGP cards, so if you have an AGP system without an SSE capable CPU you can use the 96xx-legacy driver instead if you have a problem. Only 8xxx (and newer) series cards would be a problem won't work with 96xx-legacy, but those are only PCI express, which is only found on systems which have SSE.

If you don't get this right, you will get a message when you try to start X telling you that your chip requires using legacy driver 96.xx.xx or 71.xx.xx in which case go back and try again using that version. You should probably 'apt-get remove nvidia-glx nvidia-glx-dev nvidia-kernel-dkms' first before installing the legacy driver.

nvidia still supports these legacy drivers, but they are only updated whenever a new kernel version or X server release requires small changes to the driver interface. New features are only added to the current drivers which makes sense since there probably aren't any new features that would even work on the old chips anyhow.

Step 4: Installing and configuring the nvidia glx X driver
Install the last few packages:
apt-get install nvidia-glx nvidia-glx-dev nvidia-xconfig xserver-xorg
Make sure that the version number of your nvidia-glx matches exactly the version number of the nvidia-kernel-dkms package you installed, otherwise it won't work. So if you grab the package for one from unstable for use on testing, you will have to grab the other one too.

To enable the use of the nvidia driver, run nvidia-xconfig. This will setup the xorg.conf to use the nvidia driver rather than the default nv driver. It is possible to pass various options to nvidia-xconfig to setup tv output, multiple monitors and various other options, but that is currently beyond the scope of this howto.

Some older cards may need to be told to allow composite and glx at the same time or you don't get any opengl support. To do this run nvidia-xconfig --allow-glx-with-composite.

If you want to run dual monitors run nvidia-xconfig --twinview.

Note: Any user that wants to run 3D code must be in the video group.
To add a user to the video group do this:
adduser youruser video
The next time they login to X they will have 3D access.

That's it. You should be running the new X. You should see the nvidia logo when X starts if you are succesfully running the new driver.

Notes:
If the nvidia modules doesn't load automatically and the X server complains about it, add 'nvidia' to /etc/modules to make it auto load on boot.

When upgrading, the simplest is to reboot afterwards to make sure X and the kernel module are using the same version. You could also stop X; modprobe -r nvidia; modprobe nvidia; start X again.

If you are running amd64 you might want to also install the nvidia-glx-ia32 package in case you run any 32bit programs on your system, or if you use a 32bit chroot there should be a way to install the nvidia-glx package in the chroot, although it may complain about not having any of the kernel driver packages installed. I guess installing nvidia-kernel-modules-686 or something like that in the chroot would shut it up, or you could use equivs to generate a fake package to fulfill the dependancy. If anyone ever asks for details on this I can expand further. I should have my own amd64 machine pretty soon so I can actually try that out.