Introduction
ubuntu-drivers helps us list and install Nvidia GPU drivers, and is provides simplified driver for computing purposes.
This method has been tested to be work on Ubuntu 20.04 with iGPU and nGPU hardware.
Operation
Disable Nouveau(Ubuntu Default Driver for Nvidia GPU)
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau
options nouveau modeset=0
Regenerate the kernel initramfs:
sudo update-initramfs -u
Remove exsisting Nvidia driver and CUDA
sudo apt-get autoremove
sudo apt-get remove nvidia*
sudo apt-get purge cuda*
Install Nvidia driver
# This command will install the driver
# that is considered the best match for your hardware.
#
# And the --gpgpu param ask to install driver for computing purpose,
# which doesn't include display function