How to install Nvidia Driver on CentOS

So, I installed CentOS yesterday and I never expected but installing it was a pretty good experience. Since, its mostly used as a server, it asks you in the beginning what kind of work this machine would be doing - Servers(dns/http etc.), virtualization or others. Basically, marking the appropriate packages to install before hand. This went great, but when I finally logged into it system for the first time, the default graphics performance was terrible.

All I needed was to install drivers for the video card (nVidia) but I guess when you use Ubuntu for a long time, you are clueless if you can't find an automated hardware driver installer .

However, after a little search it seems that the task is pretty easy, all you have to do is download the linux compatible driver for your graphics card (if available) from nVidia's website and install it.

Just select your card's type, series, version, os type and hit ok.

  • The card related info can be found using lspci. Look for the line mentioning the video card. This is how the output on my system looks
  • In order to find out whether the linux kernel you are running is 64 bit or 32 bit, try the following command
  • [shredder12]$ getconf LONG_BIT

    There are a variety of methods to find it out, but I find this one easy. It easily differentiated between a 32 bit Ubuntu and 64 bit CentOS running on the same system. Please note that, this only tells whether you are running a 32/64 bit kernel, not the processor.

  • Now, use the info from the above commands and fill the driver download form. Hit search and download the appopriate driver.

Before we proceed, its better to update your system to the latest kernel.

[root]# yum update

[root]# yum clean all

This step shouldn't affect your installation but its always recommended to have your system updated

Once you have the driver, open the file /etc/inittab(you should be root) and look for the line


Now, change it to


Here, we are changing the runlevel, 3 stands for only text-mode. So, the next time we boot, there won't be any gui(runlevel 5), just the old school console.

Now, reboot. I am not sure of the exact reason to reboot but I am guessing, since we will be changing the Xorg configuration file, its better to turn off the X before doing so. I tried telinit 3 to do this without rebooting but that didn't work. So, lets reboot.

[shredder12]$ reboot

As expected, you will be welcomed by a text-mode this time, log in as root and go the directory where you downloaded the nVidia driver

Make it an executable

[root]# chmod a+x

Before we actually execute it you might want to install the following two packages

[root]# yum install kernel-devel gcc kernel-headers

Now, execute it and follow the instructions

[root]# ./
Accept the license
Yes- Install NVIDIA's 32-bit compatibility OpenGL libraries
Yes- automatically update your X configuration file
OK- Successfully updated.

Now, again open the file /etc/inittab and change the runlevel form 3 to 5, because we want the GUI this time. Reboot(or just use startx) and you should see the nVidia logo this time.

P.S. The trouble with this method is that everytime a new kernel updates comes up, you will have to install it on the new one too. So, if you see X crash messages when you boot into a new kernel, shut down the X and install it again. It will hardly take any time but do remember to download and update all the pre-requisites before installation (kernel-devel etc.).

1 Comment

bart (not verified)
September 18th, 2010 12:46 pm
by temp. chmod to 600 the display manager, eg gdm,kdm in /etc/init.d then reboot the machine in single mode you can go to the telinit 3 level, just don't forget it to set it back to 755 when done

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.