Through there are many web pages teach you how to install cuda on ubuntu, I encounter a problem that I have multiple vga cards(HD4000 and 660ti) in my computer, when I follow their instruction to close the driver, nouveau, from open source community, then I boot with whole black screen. Actually, the computer is there waiting for you to login!
So I use SSH to continue the installation.
我個人的作法
Download cuda_7.5.18_linux.run from Nvidia website
$ chmod +x cuda_7.5.18_linux.runFollow the installation
$ sudo ./cuda_7.5.18_linux.run
It tell you that you have to reboot because nouveau is working
It actually make a file in /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
And its content is
blacklist nouveau
options nouveau modeset=0
And it run "$ sudo update-initramfs -u" to modify the modules in initramfs.
OK, you know what it have done to your computer now, and let's reboot.
If you find that there is whole black waiting for you, and you don't have ssh installed, try recovery mode, I just give keywords here.
boot in root shell
$ mount [sdXy] / -o remount,rw # [sdXy] is your disk partition where / locateThen you can boot normally into the familiar ubuntu desktop, and then install ssh., then run the previous procedure again.
$ rm /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
$ update-initramfs -u
$ reboot
OK, we have ssh now. Use other computer to login the poor computer.
Follow the instructions to install Nvidia driver and CUDA.
$ sudo service lightdm stop # This doesn't do anything for me.
$ sudo killall xorg # But this does.
$ sudo ./cuda_7.5.18_linux.run
Add the two line to the bottom of the file .bashrc in your home directory.
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
export PATH=/usr/local/cuda/bin:${PATH}
Then
$ source ~/.bashrc
Remember to run following command to have a good xconfig file for your card, or it may still become a workstation that you are only able to access through ssh or telnet.
$ nvidia-xconfig
Then reboot, bless you to see your familiar ubuntu desktop again.