Overclock.net › How To's › Install Nvidia Drivers in Ubuntu 11.04 & 11.10

Install Nvidia Drivers in Ubuntu 11.04 & 11.10

The Easy and Recommended way to install Nvidia Drivers in Ubuntu:

 

There are two ways that you can accomplish, there is the "easy way" and the "Complicated way". The easy way involves you using the drivers that Ubuntu prompts you to use when you first boot into Ubuntu, Under the "restricted" drivers or the "additional drivers" program available in settings. If you missed this at first boot, you can install the drivers thru the command line:

 

 

In Terminal Commands:
sudo apt-get update && sudo apt-get install nvidia-current nvidia-settings

 

This will sync apt to the latest software database, and install the nvidia drivers along with its libraries and control panel. This is the easy method cause this is all you will ever have to do. The package manager will take care of it for you, any updates it will notify you, if there is a new kernel available on an update, this driver will update itself to be used with the new kernel. The only time you shouldn't use these is if you want/need the newer drivers form nvidia or you run a custom kernel. If you have done the above, there is no need to go any further.

 

 

The Advanced Way of installing Nvidia Drivers in Ubuntu (only recommended if you need the latest drivers or run a custom kernel.)

 

If you want newer Nvidia drivers than are available in the repository for Ubuntu or run a custom kernel, it can be difficult to find a decent guide that actually works, well look no further.

 

First things first, you will need to go to Nvidia's website, and download linux drivers for your architecture (you should choose the download location to your home folder, for easy access, and this how to will assume that is where they are located). Next we need to prepare Ubuntu to be able to build the module, you will need to install a few packages from apt-get first, or verify they are installed:

 

Open up a terminal:

 

 

In Terminal Commands:
sudo apt-get install build-essential linux-headers-$(uname -r)

 

While still in terminal, we will need to remove anything Nvidia related (this is typically not needed, but if you have installed the Nvidia drivers from the repository in the past you will need to perform this step, to prevent future updates from breaking your setup.):

 

 

Quote:
sudo apt-get --purge remove nvidia-*

 

Once that is done, we will need to block/blacklist the nouveau driver from loading.

 

 

Quote:
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf

 

For this to work correctly, we also need to update the initrd (the initial ramdisk that Ubuntu uses, to properly load all drivers that are needed by the kernel to boot your system.)

 

 

Quote:
sudo update-initramfs -u

 

Once that is complete, you will need to restart. At the Grub Splash menu, select "recovery mode", if there are multiple ones, choose the first one in the list for "recovery mode" that will be your most recent kernel. If Ubuntu is the only OS that is installed, Grub's splash menu will not show, not giving you the option to "enter recovery mode", the easiest way around this, right after POST is done, hold down your shift key, this will bring up Grub's splash menu.

 

Recovery mode will boot to another menu selection, select "netroot", if netroot is not present, choose "remount" then the netroot option should be available. You will now be in a root console.

 

 

In Terminal Commands:
cd /home/{username}/
chmod +x NVIDIA  (hit tab at this point, and it should auto-complete the rest, hit return)
./NVIDIA (hit tab again, this will auto-complete, hit return.)

 

You should now be in the Nvidia license agreement screen, agree, then follow the onscreen instructions (it will give you two errors and ask you to continue, the first will be a run level check, the second will be about distro build scripts missing, continue on both, they will not hinder building or installing the Nvidia drivers). It will build the kernel module, install it, it will ask if you want to install Nvidia's 32 bit opengl libraries, I advise you should, it will also want to auto configure xorg.conf, if you don't want to configure xorg.conf manually, then you should let the installer do it for you.

 

Once the installer is done, you will find yourself back at the command prompt, type in exit and hit return, it will take you back to the recovery options menu, just select "resume" it will continue a normal boot of your system. Nvidia drivers will be installed, and you should be using them. 

 

If for some reason Ubuntu is not using the new drivers, and you have rebooted and they are still not being used. You could try setting up xorg.conf yourself, or use:

 

 

Quote:
sudo nvidia-xconfig

 

This will back up your existing xorg.conf, and build a new one, using the nvidia drivers and setting up a basic profile for the card you are using. 

 

If you have multiple monitors, and wish to use them, you can use nvidia-settings, to setup twinview, or seperate xorg servers and the use of xinerama.

 

 

Quote:
sudo nvidia-settings

 

This will bring up the GUI for nvidia-settings, which will give you control over features of your card, similar to the nvidia-control panel in windows. (make sure you apply and save any changes you make here, for whatever reason if the dialogue box is empty when you go to save, enter this in /etc/X11/xorg.conf, and then click on save).

 

NOTE: If you add a custom kernel, or there is an update for a kernel from Ubuntu, then you will need to re-install the drivers. 

 

 

 

Comments (3)

I found this guide to be just about as straight-forward as possible! Drivers installed in no time on Ubuntu 11.10
Good job transhour. Now I can use an OCN link instead of a buntu one whenever I forget the steps. But are you planning on including the x-swat repo as well?
Great guide that doesn't go 'around the houses'!!

Can you do the same for installing the 'nouveau' drivers?

Thank you.
Overclock.net › How To's › Install Nvidia Drivers in Ubuntu 11.04 & 11.10