We had some issues when we tried to download the CUDA Toolkit .deb file and use the apt-get package manager to install CUDA Toolkit on Ubuntu 15.04. So instead we just manually installed the CUDA Toolkit .run file.
We used these resources to piece together the right steps for doing this. http://developer.download.nvidia.com/compute/cuda/7.5/Prod/docs/sidebar/CUDA_Installation_Guide_Linux.pdf http://www.allaboutlinux.eu/remove-nouveau-and-install-nvidia-driver-in-ubuntu-15-04/2/ https://askubuntu.com/questions/16371/how-do-i-disable-x-at-boot-time-so-that-the-system-boots-in-text-mode
Remove existing nvidia stuff:
sudo apt-get remove nvidia*
sudo apt-get autoremove
Update and download some additional tools:
sudo apt-get update
sudo apt-get install dkms build-essential linux-headers-generic
We need to blacklist the nouveau driver
sudo vi /etc/modprobe.d/blacklist-nouveau.conf
Place the following lines in the file:
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
Disable the nouveau kernel
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
We want to boot into text mode, so we need to update grub and systemd:
sudo vi /etc/default/grub
Edit this line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
To be:
GRUB_CMDLINE_LINUX_DEFAULT="text"
Now we'll tell systemd to not load the graphical interface:
sudo systemctl enable multi-user.target --force
sudo systemctl set-default multi-user.target
Go to the nvidia website and download the cuda toolkit.
Now reboot the computer and you should be at the command prompt.
Make sure the X-server is stopped.
sudo /etc/init.d/lightdm stop
Run the cuda .run file and answer the prompts.
chmod +x cuda_7.5.18_linux.run
sudo ./cuda_7.5.18_linux.run
If the script complains about an X server, then you may need to delete a lock file in /tmp.
rm /tm/.X1-lock
We need to revert the changes on the graphical interface.
sudo vi /etc/default/grub
Edit this line:
GRUB_CMDLINE_LINUX_DEFAULT="text"
To be:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Tell systemd to load the graphical interface:
sudo systemctl set-default graphical.target
Reboot the system.
Check to see that there are /dev/nvidia* device files. If not, then the installation did not work. You may have missed an error message in the print outs while installing the .run file.
Set your environment variables in your ~/.bashrc file:
export PATH=/usr/local/cuda-7.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
If you created the symbolic link /usr/local/cuda -> /usr/local/cuda-7.5 when installing the toolkit, then you can remove the -7.5 portion in the environment variables.
If you are also intsalling the cudann libraries, you can copy them over to the /usr/local/cuda/lib64 and /usr/local/cuda/incude directories:
tar -xvf cudnn-7.0-linux-x64-v4.0-prod.tgz
sudo cp cuda/lib64/* /usr/local/cuda/lib64/
sudo cp cuda/include/* /usr/local/cuda/include/