Monday, September 26, 2011

How to install CUDA 4.0 on Ubuntu 10.10 or later

First, you need to install the NVIDIA development drivers. Download the current version (270.41.19) here.
To install the dev drivers, reboot and go into recovery mode. Select the "Drop to root shell prompt" option. Now type:
sudo telinit 3
Login again using your username, then cd to the directory where you downloaded the drivers (e.g. ~/Downloads):
cd ~/Downloads
chmod u+x
sudo ./
Follow the instructions on the screen. Make sure you write to your xorg.conf file. When done reboot:
sudo reboot
Download the CUDA Toolkit from this page (Linux -> CUDA Toolkit for Ubuntu Linux 10.10).
cd ~/Downloads
chmod u+x
sudo ./
Finally, download the GPU Computing SDK from the above website.
cd ~/Downloads
chmod u+x gpucomputingsdk_4.0.17_linux
Add the these lines at the end of your ~/.profile (if your OS is 32-bit, remove the lib64 entry):
#CUDA stuff
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
Now you just need to compile the samples. Assuming you installed the SDK in your home directory:
cd ~/NVIDIA_GPU_Computing_SDK
You can now run one of the demos, e.g. the particle demo
and you should see something like this:


  1. what is the job of this command: sudo telinit 3
    after doing this it does not accept the password

  2. Changes your system's runlevel to 3, which is needed by the driver to install. You then login with your normal user account. I can't think of any reason why it shouldn't accept your password.

  3. When I run the command sudo telinit 3 runs some code and then displays the msg:

    grub-editenv: error: cannot open the file /boot/grub/grubenv
    [ 16.389598] init: plymouth-stop pre-start process (596) terminated with status 1

    Then it asks for my login, but it wont accept anything and it seems as if something is bugged. I'm running Ubuntu 11.10

  4. I think
    "Ctrl+Alt+F1" and then
    "sudo service gdm stop" does the same thing

  5. yeah that should do the same.

  6. Hi Kary,
    I tried installing cuda 4.0 on ubuntu 10.10 but faced error nvidia-installer must be run as root

    1. Sudo telinit 3
    2. Login
    3. cd Downloads
    4. chmod u+x
    5. ./
    error appears nvidia-installer must be run as root.
    Could you help me with this

  7. Thanks Kary for the useful thread.

    I was able to resolve my doubt using sudo before step 5 i.e sudo ./