Installing graphics drivers can be a real pain on Linux. Luckily, things have gradually gotten simpler over time. If you are an Nvidia user running Linux (or in my case, a Linux user running Nvidia), then you are in luck. Installing the official Nvidia drivers is pretty simple.
NOTE: I’m running Ubuntu here on my desktop, but I’ll try to keep things as universal as possible.
Step 1. Download the Drivers
The easiest method to downloading the latest drivers is by following the directions on Nvidia’s own driver download page. If you are in the mood to try out beta or older versions of the drivers, check out this page.
Step 2. Kill the X Server
The Nvidia installer will complain if you try to install new drivers while the X server (a.k.a. all the graphic user interface stuff) is running. So, you’ll have to jump to a new session by hitting Ctrl+Alt+F1. This will bring you down to a text-only terminal. Login if it asks you to.
Now, GNOME (which uses gdm) users will usually enter this to stop the X Server:
sudo /etc/init.d/gdm stop
sudo /etc/init.d/kdm stop
Navigate to the directory where the driver installer downloaded to. For me, this was /home/eddie/Downloads:
sudo sh ./NVIDIA-Linux-x86_64-195.36.15-pkg2.run
Step 4. Follow the Installer’s Instructions
The installer should ask you a few questions as it installs the new drivers. It is usually safe (and recommended by myself) to say yes to all of the questions asked (install 32-bit OpenGL libraries, create a fresh Xorg.conf, etc.). After the questions, sit back and let the installer finish.
Step 5. Reboot and Enjoy
And now you are done! Reboot and enjoy the up-to-date drivers:
If you run Ubuntu, then you will see this everytime you try to install a new driver. Just ignore it, the install script provided by the Ubuntu developers fails on purpose.
2. Error locating kernel source
If you are like me and have compiled your own custom kernel, this problem will probably affect you. If you do not run a custom kernel, and use the default, distribution provided kernel, then you probably do not the kernel headers installed. On Ubuntu, this is simple to fix:
sudo apt-get install kernel-source
sudo sh ./NVIDIA-Linux-x86_64-195.36.15-pkg2.run --kernel-source-path=/usr/src/linux-headers-2.6.32-bfs311-idlesoft-desktop-amd64/