Information Security, Web, Networks and Systems

Tuesday, December 23, 2014

Installing CUDA Toolkit 6.5 in Ubuntu 14.10/14.04

10:44 PM Posted by Deepal Jayasekara , , , 14 comments

Checking system capability

First of all, you need to check whether your GPU is CUDA-capable. You can see whether your GPU is listed in CUDA GPUs at


Download the CUDA Toolkit from,
You need to download the RUN installer for Ubuntu 14.04.

Installing background

Before installing CUDA toolkit, you need to first install nvidia proprietery driver in Ubuntu. You can install this using Additional Drivers in Ubuntu.

Then you need to exit the ubuntu graphics session and go to CLI. For this, press ctrl+alt+f1 and run the following command to stop lightdm display manager.

sudo service lightdm stop

Once the lightdm is stopped, you can proceed to next steps.

Installing Prerequisites

If your system does not include necessary dependencies, you might encounter following error when installing CUDA toolkit.

Missing recommended library:
Missing recommended library:
Missing recommended library:
Missing recommended library:

You need to install additional libraries which installs above dependencies as follows:

sudo apt-get install libglu1-mesa libxi-dev libxmu-dev

Installing CUDA toolkit and samples

Once dependencies are installed, go to where the CUDA toolkit is downloaded, and run the following command to start the installation.

sudo chmod a+x
sudo ./

If you get an error saying,

Unsupported compiler 4.*.*. Use --override to override this check

it says that your gcc compiler is incompatible with the installation. To prevent this error, you need to change the installation step as,

sudo ./ --override compiler

You can then accept the EULA, and at the next step, do not install nvidia accellerated graphics driver(select no to when asking to install the driver), since we already have installed a proprietery driver.

If everything went well, your installation will complete successfully. After installation, you can enable Nvidia C Compiler (nvcc) by including following lines at the end of ~/.bashrc file.

For 32 bit include following two lines at the end of bashrc file

export PATH=$PATH:/usr/local/cuda-6.5/bin
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib

For 64 bit include following two lines at the end of bashrc file

export PATH=$PATH:/usr/local/cuda-6.5/bin
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:/lib

When it is done, you can check you ncc by running the command,

nvcc --version

You can then go back to your graphics session by running,

sudo service lightdm start

These steps worked for me. Feel free to put a comment below if you encounter an error during installation.

Thank you.


  1. Very useful post! It solved my problem. Thx

  2. Thanks very much for this great post! Saved my day. After 2 days of struggle with other methods (and a crashed system), this worked like a charm on a fresh install.

    Installed & tested on:

    Lenovo ThinkPad W541
    Ubuntu 15.04
    NVIDIA Quadro K2100M
    NVIDIA driver 352.63

  3. It says installing toolkit and samples. Does this howto install samples?

  4. Thanks a lot! --override compiler saved my day!

    1. You are welcome!. Great to have helped you.

  5. Hi All,
    Thank you so much for this wonderful tutorial.
    Could you please tell me how to proceed in order to downgrade the gcc version by which nvcc will work with. When I try to make the deviceQuery project it fails and says g++: No such file or directory. I am afraid of trying anything that will screw everything up !
    Thank you so much for your help in advance.

    1. You are welcome!. I think there is a problem with g++ on your system. Check whether it's installed properly and it's path is included in the path environment variables. Try running 'which g++' to check your installation.

  6. I am in love with you! Thank you for making this!!!

    1. You are welcome! Good to here this post helped you.

  7. This comment has been removed by a blog administrator.

  8. i get the following error after the installation step:

    You are attempting to install on an unsupported configuration. Do you wish to continue? ((y)es/(n)o) [ default is no ]: y
    Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 340.29? ((y)es/(n)o/(q)uit): n
    Install the CUDA 6.5 Toolkit? ((y)es/(n)o/(q)uit): y
    Enter Toolkit Location [ default is /usr/local/cuda-6.5 ]: /usr/local/cuda-6.5
    Do you want to install a symbolic link at /usr/local/cuda? ((y)es/(n)o/(q)uit): y
    Install the CUDA 6.5 Samples? ((y)es/(n)o/(q)uit): y
    Enter CUDA Samples Location [ default is /root ]: /root
    Installing the CUDA Toolkit in /usr/local/cuda-6.5 ...
    mkdir: cannot create directory ‘/usr/local/cuda-6.5’: File exists
    cp: cannot create regular file '/usr/local/cuda-6.5/bin': No such file or directory
    Couldn't open cuda-6.5.pc to write: No such file or directory at ./ line 680, chunk 19.

  9. i have a legacy driver Quadro fx 770m (340.96 installed)
    I cant seem to find any solutions on how to install cuda toolkit 6.5.19-3.
    The steps above so far work, until that last part that i posted above.
    Im on Kali Linux 2016.2, i cant find the correct package on kali repository either, which i edit in old repositories as well. When I issue the cmd, "apt-get --no-install-recommends install nvidia-cuda-toolkit" it keeps trying to install a cuda-toolkit package my nvidia driver doesn't even support. i figured i use the instalation steps above since kali and unbutu have simalar terminal cmd's. please help.


Note: Only a member of this blog may post a comment.