首先ctrl + alt + F1進入字符界面
1. 刪除原有驅動
sudo apt-get purge nvidia*
sudo apt-get autoremove
sudo ./NIVIDIA-Linux-X86_64-384.59.run --uninstall
2. 安裝依賴
sudo apt-get install build-essential gcc-multilib dkms
3. 禁用nouveau驅動:
編輯 /etc/modprobe.d/blacklist-nouveau.conf 文件,添加以下內容:
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
關閉nouveau:
$ echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
4. reboot
$ sudo update-initramfs -u
$ sudo reboot
重啟后,執行:lsmod | grep nouveau。如果沒有屏幕輸出,說明禁用nouveau成功。
5. 獲取kernel source (important)
$ apt-get install linux-source
$ apt-get install linux-headers-x.x.x-x-generic
其中x.x.x-x-generic可以通過$(uname -r)替換得到
6. 關掉x graphic 服務
sudo systemctl stop lightdm(or sudo service lightdm stop)
sudo systemctl stop gdm
sudo systemctl stop kdm
登陸nvidia官網,可以得到適合自己電腦的驅動,下載下來
7. 安裝nvidia驅動
sudo chmod NVIDIA*.run
sudo ./NVIDIA-Linux-x86_64-384.59.run –no-x-check -no-nouveau-check -no-opengl-files
- –no-opengl-files:表示只安裝驅動文件,不安裝OpenGL文件。這個參數不可省略,否則會導致登陸界面死循環,英語一般稱為”login loop”或者”stuck in login”。
- –no-x-check:表示安裝驅動時不檢查X服務,非必需。
- –no-nouveau-check:表示安裝驅動時不檢查nouveau,非必需。
- -Z, --disable-nouveau:禁用nouveau。此參數非必需,因為之前已經手動禁用了nouveau。
- -A:查看更多高級選項。
安裝過程中一些選項
The distribution-provided pre-install script failed! Are you sure you want to continue?
選擇 yes
繼續。
Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later?
選擇 No
繼續。
問題大概是:Nvidia's 32-bit compatibility libraries?
選擇 No
繼續。
Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up.
選擇 Yes
繼續
8. 掛載Nvidia驅動
modprobe nvidia
9. 檢查驅動是否安裝成功
nvidia-smi
nvidia-settings #若彈出設置對話框,亦表示驅動安裝成功
10. 返回圖形界面
最后退回圖形界面:sudo init 5
or ctrl + alt + f7
or sudo service lightdm restart
11. reference
掛載u盤https://www.cnblogs.com/dmj666/p/8031828.html
參考的博客:
https://blog.csdn.net/stories_untold/article/details/78521925
以上,有問題歡迎討論,如果有幫助,請點一下推薦
參考:https://blog.csdn.net/cosmoshua/article/details/76644029?tdsourcetag=s_pctim_aiomsg