00 - About
This is a very quick tutorial about installing nvidia drivers in Linux. I did this to help some friends out as well as some members from Linux Questions. I would like to thanks "Korff" from LQ for some tips. Remember that this is a quick tutorial. You really are better off reading Nvidia official documentation about doing this...
With the method here described, I was able to successfully install Nvidia drivers with Mandrake 9.0/9.1/9.2, Slackware 9.0/9.1 and Redhat 9.0. Some distributions as Suse has a different way of installing drivers, while others, as Libranet 2.8 and above already provide the driver out of the box. Check both Nvidia and your distribution manual/FAQ before trying to install anything...
Please, also note that I've installed this driver with 3 different cards only: Nvidia Geforce4 MX 440 AGP, Nvidia Geforce4 MX440 PCI and TNT2. However, this method should work fine with any Geforce or TNT family, but I cannot confirm that...
Needless to say, this doc comes with no warranty and I will not be responsible for any damage that it may cause to you or you system, cat friend, family or anything else... Use it of your own risk or don't use :)
Have fun!
01 - Reading the docs and downloading the correct driver...
First, it's time to read some docs. This is the official installation guide from Nvidia. Suse users should read this before proceding. I've never tried Suse myself, so I cannot guess how the installation on Suse will be. However, I've tried and this will work with Mandrake 9.0/9.1/9.2, Slackware 9.0/9.1 and Redhat 9.0.
Now you've to go to Nvidia's homepage and grab the official driver for you system. Many peoples are not sure which driver to pick up. If you've have an ordinary ix86 PC, you most likely will want to download this one: IA32 . and save to your HD. Eventually, nvidia will change the above link when a new driver is available, so I'll not keep updating this link. Simply remember that your system is a IA32 and you will do fine ;-).
02 - Make sure that you have kernel-source and gcc installed...
Nvidia did a great job with their Linux installer and it should install on any Linux distribution with few exceptions, as long as you have both the kernel-source and gcc packages installed. That's necessary for Nvidia to be able to "build" the driver into the kernel, as far as I understand.
Please note that very few distributions ship the kernel-source package within the "standard" install disks. The easiest thing to do is to go into your distribution homepage and search for the kernel-source package. It usually is a big file, mind you. Mandrake 9.2 kernel-source packages is called kernel-source-2.4.22-10mdk.i586.rpm in the case you've have kernel-2.4.22.10 installed, for example. If you don't know which kernel version you have installed, type:
uname -r
at the console/terminal to find it out. I will not tell you how to install the kernel-source package for your specific distribution, because that would simply not be possible considering the hundreds different Linux distributions available out there :). But it's simply a matter to install it as an ordinary package...
If you are not sure if you either has or not the kernel-source installed, with an rpm-based distribution (Such as Mandrake, Redhat, Debian, ...), it's a simple matter of running the following command:
rpm -qa | grep kernel
As it usually is a big package (over 100 Mega maybe when installed), you can remove it once you have nvidia drivers up and running to free some space, if you wish to do so...
03 - Changing the Linux runlevels...
To install nvidia driver, it's necessary to be into Text Mode.To boot Linux into Text Mode, you've to edit the runlevels. There're two ways of doing this. The first and recommended one, is the easiest.
Method 1:
Here, you have to know which runlevel makes your distribution to boot into text mode. This varies from one distribution to another. Mandrake uses runlevel 3 for text mode 5 for Graphical mode, while Slackare uses 4 for Graphical mode. The best way to find out is to open the file called "inittab" located at your /etc.You will find something like "5:Multi-user mode, graphical login" and "3:Multi-user mode" for example. That means that runlevel 5 is for graphical login and 3 for text login. When you've found out which runlevel gives you a text login, close all windows you have open and press
ctrl + alt + F1
You will bring a "fullscreen" terminal up. Login as root and type:
telinit 3
if 3 is the number for your distribution to login into text mode. That will close your X-server completely and you are now able to install Nvidia drivers as described in 04 - Installing the driver....
Method 2:
This is another way of doing the same thing as method 1 and, although efficient, it requires rebooting and editing files... just use this if something goes wrong with method 1.
Do everything as described in method 1 until you open the file called "inittab" located at your /etc. once in there, find a piece of code that looks something like this:
# Level to run in
id:5:initdefault:
Substitute "5" for the run level number that your distribution needs to text login. You will now need to reboot your computer. Next time you boot, you will login into text mode. You can now keep reading this tutorial :).
04 - Installing the driver...
Finally, the fun part and also the easiest. As root, navigate through your files until you find the nvidia driver that you downloaded. Once you find it, run the script with:
sh NVIDIA-Linux-x86-1.0-5336-pkg1.run
or
./ NVIDIA-Linux-x86-1.0-5336-pkg1.run
choose any of the above, whatever works for you :). If you have a different driver then the above, just type the fullname of the driver you have.
Nvidia installer may complain that you a kernel was not found and that the installer will try to connect to nvidia's ftp to download a matching kernel. Just ignore that... If you have the kernel-source and gcc installed, nvidia installer _will_ build a kernel for you!
So, congratulations, your driver is installed!!!. Is that it? No... Now you've have to tell xfree to use nvidia drivers. That's easy, don't worry. Still as root, open the file "XF86Config" located at /etc/X11. Please note that some distributions as Debian and Mandrake, may use a file called "XF86Config-4" instead, so edit that one if so is the case.
Scroll down that file until you find something like this:
Section "Device"
Identifier "VESA Framebuffer"
Driver "vesa"
...
Where it stands Driver "vesa"(could also be "nv" or anything else") you will substitute to "nvidia". Please note that Linux is a case sensitive Operating System, meaning that "nvidia" is different of "Nvidia", which is different of "NVIDIA". The correct is "nvidia". Now that's it. Everything is installed and xfree86 will use nvidia driver. You can try to start X-server by typing "startx" at the console. A Nvidia logo will be shown telling you that Nvidia drivers are working right before your Window Manager is loaded.
The only thing left to do is to go through step "03 - Changing the Linux runlevels..." and set things back the way they were before. If you've choosen method 1, simply type "telinit 5(if 5 is your graphical login runlevel). If you've chosen method 2, re-edit the "id:5:initdefault:" back to the number it was before you've edited.
Now that's all. I will extend this tutorial when I have time to configure your graphic card for TV-Out. For the moment, enjoy you 3D accelerated Linux box :D
Have fun!