Let's do the preparatory work first:
Uninstall the existing driver version (optional)
sudo apt-get remove --purge nvidia*
Start
1. First look at which version of the driver your Ubuntu kernel supports:
sudo apt-cache search nvidia*
For example, mine is up to nvidia-384 (nvidia-384 - NVIDIA binary driver - version 384.111)
2. Next, you can go to the NVIDIA official website to download the driver version you want to install
NVIDIA-Linux-x86_64-384.111.run
3. Edit dependencies
Execute uname -r , my result is 4.13.0-39-generic
uname -r
sudo apt-get install build-essential pkg-config xserver-xorg-dev linux-headers-4.13.0-39-generic
4. Shield open source driver nouveau
Create new file:
sudo vim /etc/modprobe.d/blacklist-nouveau.conf
Press a to enter insert mode and add content as
blacklist new
options new modeset=0
After pressing ESC, enter: wq to save and exit
and then update
sudo update-initramfs -u
5. End the X-window service
End the x-window service (very important!)
sudo service lightdm stop
(The screen will be black at this time, don't worry, press Ctrl + Alt + F1 to enter the tty1 console)
install driver:
sudo chmod u+x NVIDIA-Linux-x86_64-384.111.run
sudo ./NVIDIA-Linux-x86_64-384.111.run
4. Installation is complete!
It may appear that the installation cannot be successful according to this method, but closing the driver of the system itself may lead to a successful installation later!
So you can directly install the driver through apt-get:
sudo apt-get install nvidia-384 nvidia-settings nvidia-prine
You can sudo apt-get install nvidia-
then tab to select the latest driver version from the list and replace the abovenvidia-384