How to install CUDA on lenny/ubuntu 8.04.1(8.10?)

I have installed CUDA on the following machine:
M/B: MSI K9N2 Diamond (nForce 780a which means GeForce8300)
Video: Asus ENGTX260

Display connector is connected to IGP(nForce 780a) not discrete graphic(GTX 260)

I have succeeded both lenny & ubuntu(server & desktop). Here is how to.

CUDA install to 64-bit lenny/buntu 8.04.1(8.10?)

a. The following assume lenny/ubuntu installation is complete.
b. Also the content heavily borrows:…-in-ubuntu.html
c. ModCUDA is obtained from:
d. 64-bit related error is solved through CUDA forum thread
e. Downloading nVidia display driver, CUDA Toolkit and SDK in advance is strongly recommended.

  1. Login as root, and install 32-bit compatible lib

    apt-get install ia32-libs

  2. Prepare for kernel rebuild

    apt-get install make libc6-dev gcc-4.1 binutils

  3. Also install the associated linux-headers
    uname -r apt-cache search linux-headers

    apt-get install linux-headers-??

  4. Install nVidia display drivers
    a. Download driver from nVida site to /home/toshi, and make it executable

    chmod +x

    b. Set to appropriate alternative gcc version (currently 4.1)

    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.1 41

    c. Choose appropriate gcc version for driver install

    update-alternatives --config gcc

    d. Install the build tools we need (this will install a bunch of X packages if X is not installed previously).

    apt-get install build-essential libglut3-dev -y

    e. If in X window, stop using it, and use console by hitting Ctrl+Alt+F1, login, and execute the rest of the commands

    /etc/init.d/gdm stop


    f. Edit /etc/X11/xorg.conf because we often endup with lousy monitor settings.
    g. If ubuntu edit /etc/default/linux-restricted-modules-common to resolve a driver conflict.

    add add ‘nv’ to DISABLED_MODULES (‘DISABLED_MODULES=“nv”’)

  5. If X windows is installed, examine its proper functioning by starting it.

  6. If lenny, install for pciutils, and g+±4.1

    apt-get install pciutils g+±4.1

    update-alternatives --install /usr/bin/g++ g++ /usr/bin/g+±4.1 41

    update-alternatives --config g++

  7. If no X is installed, obtain ModCuda, and run it

    ./ModCuda start

  8. Confirm nvidia devices

    ls /dev/nv*

  9. Install the CUDA Toolkit
    a. Download toolkit
    $ wget…
    b. Make it executable

    chmod +x

    c. Run

    ./ auto

A. Now exit from root, and login as a normal user

B. Append environment variables
$ echo “# CUDA stuff
export PATH
export CFLAGS” >> ~/.bashrc
then restart the terminal for the changes to take effect.

C. Confirm nvcc working by
$ nvcc --version

D. Install the CUDA SDK
a. Download SDK
wget [url=""][/url] b. Make it executable chmod +x ./
c. Run
$ ./

E. Compile and run an example: fluidsGL in X; otherwise choose a non-X example.
a. Change to a directory
cd NVIDIA_CUDA_SDK/ b. Compile all examples make
If there is an error of 64-bit related, edit common/ (They are nvidia’s bugs, I believe)
2 lines: 73 and 125 -m32 --> -m64
c. If in X, run fluidsGL example
~/NVIDIA_CUDA_SDK/bin/linux/release/fluidsGL otherwise run deviceQuery example ~/NVIDIA_CUDA_SDK/bin/linux/release/deviceQuery

F. If ubuntu desktop, install the nVidia settings GUI
# apt-get install nvidia-settings
(If we install nvidia driver through debian way, we can do the same. But I have not confirmed it.)

This one should probably be made sticky.

Although I haven’t gone through this guide step-by-step, the part of switching gcc to 4.1 is also the same I did to make CUDA compile and run on Ubuntu 8.10.