install nvidia driver on linux.

check latest nvidia driver by this link

Ubuntu

  1. install build need package
apt install build-essential
  1. Blacklist Nvidia nouveau driver
1
2
sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"

Confirm the content of the newly created modeprobe file blacklist-nvidia-nouveau.conf:

1
2
3
$ cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0

Enter the following Linux command to update kernel initramfs:

sudo update-initramfs -u

Last step is to reboot your system:

sudo reboot +0

Install CUDA

apt update
apt install nvidia-cuda-toolkit
  1. (method1) install official run driver
chmod +x NVIDIA-Linux-x86_64-470.199.02.run
sudo ./NVIDIA-Linux-x86_64-470.199.02.run
  1. generate xorg configure file
sudo nvidia-xconfig

Uninstall Nvidia Driver

ubuntu repository and PPA NVIDIA drivers

  1. First thing you will need to do is open a command line terminal. Then, executing the following commands will remove the proprietary Nvidia driver:
sudo dpkg -P $(dpkg -l | grep nvidia-driver | awk '{print $2}')
sudo apt autoremove
  1. Switch back to nouveau driver by downloading the latest version with apt package manager:
sudo apt update
sudo apt install xserver-xorg-video-nouveau
reboot +0
  1. Once your system has rebooted confirm loaded nouveau modules with the lsmod command:
1
2
3
4
5
6
7
8
9
$ lsmod | grep nouveau
nouveau              1949696  4
mxm_wmi                16384  1 nouveau
ttm                   106496  1 nouveau
drm_kms_helper        184320  1 nouveau
drm                   491520  7 drm_kms_helper,ttm,nouveau
i2c_algo_bit           16384  1 nouveau
wmi                    32768  3 wmi_bmof,mxm_wmi,nouveau
video                  49152  1 nouveau

official NVIDIA drivers

  1. Uninstall the Nvidia Driver. Update the below Nvidia script name where appropriate :
sudo bash NVIDIA-Linux-x86_64-XXX.XX.run --uninstall
  1. If you have not done so yet, restore your xorg original configuration from backup:
sudo nvidia-xconfig --restore-original-backup
  1. Enable Nouveau modules.
rm -f /etc/modprobe.d/blacklist-nvidia-nouveau.conf
reboot +0