其實有很多教學了,有個小小的點是,如果你有多顯卡,在關閉開源社群的driver nouveau的時候可能會完全沒有畫面,但其實已經開好機在等你login了
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.run
$ sudo ./cuda_7.5.18_linux.run
Follow the installation
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 / locate
$ rm /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
$ update-initramfs -u
$ reboot
Then you can boot normally into the familiar ubuntu desktop, and then install ssh., then run the previous procedure again.
OK, we have ssh now. Use other computer to login the poor computer.
$ sudo service lightdm stop # This doesn't do anything for me.
$ sudo killall xorg # But this does.
$ sudo ./cuda_7.5.18_linux.run
Follow the instructions to install Nvidia driver and CUDA.
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.