WARNING: Manual installation of NVIDIA drivers on Ubuntu, particularly from the official NVIDIA.com source, is not recommended for all users due to potential compatibility issues with future kernel updates.
sudo lshw -numeric -C display or sudo lspci -vnn | grep VGA or sudo ubuntu-drivers devices
NOTE: This will help to determine which driver is needed.
Visit the Official Nvidia website.
Download the appropriate driver for your graphics card.
sudo wget https://us.download.nvidia.com/XFree86/Linux-x86_64/510.60.02/NVIDIA-Linux-x86_64-510.60.02.run
sudo apt install build-essential libglvnd-dev pkg-config
The default Nouveau Nvidia driver must be disabled before installing the official Nvidia driver.
See Blacklist the Nouveau driver.
WARNING: After the reboot you may end up without GUI at all.
Before installing the driver, it is mandatory to stop your current display server by changing the run level to 3.
WARNING: Remember to save all current work before proceeding, as this will stop the desktop environment.
sudo telinit 3
sudo bash NVIDIA-Linux-x86_64-510.60.02.run
NOTE: Follow the on-screen instructions to complete the driver installation.
Restart run level 6.
sudo init 6
NOTE: This will reboot your system and start it with display server on.