Installing CUDA Toolkit 4.1 on Ubuntu 11.04 Linux
The following explains how to install CUDA Toolkit 4.1 on 64-bit Ubuntu 11.04 Linux. I have tested it on a self-assembled desktop with AMD Phenom II X4 CPU, 4GB RAM, 500GB hard drive, 650W power supply, and NVIDIA GeForce GTX 460 graphics card. The instruction assumes you have the necessary CUDA compatible hardware support. Depending on your system configuration, your mileage may vary.
Basic Video Driver
First of all, you have to reconfigure Ubuntu with the basic video driver. Enter the following in a terminal.
Then create a new file in /etc/modprobe.d with the following content in order to blacklist the built-in nouveau driver, which conflicts with the CUDA developer video driver that you will install later.
blacklist nvidiafb
blacklist nouveau
blacklist rivafb
blacklist rivatv
blacklist vga16fb
options nouveau modeset=0
You should manually update the kernel image in a terminal afterward:
Now you can reboot the system at this point for the change to take effect.
Linux Development Tools
After you have successfully configured Ubuntu Linux with the basic video driver, you can install the Linux development tools.
OpenGL Developer Driver
To prepare for compiling the OpenGL code samples in the CUDA SDK, you will have to install the OpenGL developer environment as well.
CUDA Developer Driver
Download the CUDA developer driver from the CUDA download site. The graphical display manager must not be running during the CUDA video driver install. Hence you should logout your Linux desktop and switch to console mode with the Alt+Ctrl+F2 keystroke. You then login the text console, and stop the graphical display manager.
You may have to enter the same Alt+Ctrl+F2 keystroke again to resume the text console. Now install the CUDA developer video driver:
And reboot afterward:
CUDA Toolkit
Download and install the CUDA Toolkit from the CUDA site, and run the following:
Assuming you have accepted the default install location /usr/local/cuda, you should add the following in the .bashrc file of your home folder.
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${CUDA_HOME}/lib64:${CUDA_HOME}/lib"
export PATH=${CUDA_HOME}/bin:${PATH}
CUDA SDK Samples
Download and install the CUDA SDK:
With the default install location NVIDIA_GPU_Computing_SDK in your home folder, you can now build the SDK samples.
If everything goes well, you should be able to verify your CUDA installation by running the deviceQuery sample in the NVIDIA_GPU_Computing_SDK/C/bin/linux/release folder of your home directory.