How to install Nvidia driver in Ubuntu 18.04?
I downloaded the Nvidia driver for Linux from the official Nvidia website to install in my laptop. It is a file named NVIDIA-Linux-x86_64-390.67.run. How to install this file?
Solution 1:
Determine the latest version of Nvidia driver available for your graphics card
Visit the graphics drivers PPA homepage here and determine the latest versions of Nvidia drivers
Verify that your graphics card is capable of running the latest drivers.
If your graphic is supported, you can go ahead and remove all previously installed Nvidia drivers on your system. Enter the following command in terminal.
sudo apt-get purge nvidia*
Add the graphics drivers PPA
Let us go ahead and add the graphics-driver PPA -
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
Install (and activate) the latest Nvidia graphics drivers. Enter the following command to install the version of Nvidia graphics supported by your graphics card -
sudo apt-get install nvidia-XXXX
OR
sudo apt-get install nvidia-driver-xxxxx
(xxxx - is the Supported Version for your Nvidia driver)
Reboot your computer for the new driver to kick-in. You can check your installation status with the following command
lsmod | grep nvidia
If there is no output, then your installation has probably failed. It is also possible that the driver is not available in your system's driver database. You can run the following command to check if your system is running on the open-source driver nouveau. If the output is negative for nouveau, then all is well with your installation.
lsmod | grep nouveau
This is my terminal output of Nvidia Drivers.
devansh@varshney:~$ nvidia-smi
Wed Apr 24 01:14:16 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.56 Driver Version: 418.56 CUDA Version: 10.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce 940MX Off | 00000000:01:00.0 Off | N/A |
| N/A 52C P5 N/A / N/A | 254MiB / 2004MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 3975 G /usr/lib/xorg/Xorg 108MiB |
| 0 4002 G /usr/lib/firefox/firefox 1MiB |
| 0 4350 G /usr/bin/gnome-shell 137MiB |
| 0 5204 G /usr/lib/firefox/firefox 1MiB |
| 0 24924 G /usr/lib/firefox/firefox 1MiB |
+-----------------------------------------------------------------------------+
Solution 2:
I am using the nvidia-driver-390 driver version 390.48 in 18.04 which was installed with the following command:
sudo ubuntu-drivers autoinstall
sudo reboot
When installing a proprietary graphics driver, it is not necessary to uninstall the open source graphics driver. The two graphics drivers can be installed alongside each other allowing the open source graphics driver to be used as a fallback alternative in case there is a problem using the proprietary graphics driver.
The ubuntu-drivers autoinstall
command installs drivers that are appropriate for automatic installation including their dependencies, and the Nvidia driver will also be updated automatically when an update is available. Sometimes sudo apt upgrade
even upgrades the proprietary graphics driver packages to more recent packages, in which case sudo apt autoremove
removes the older packages which were replaced by the newer ones. For most users there's no reason to guess about which proprietary graphics driver to install, because if your system deserves a graphics driver upgrade it will get one.
If you visit the official AMD or NVIDIA websites you will often see that the latest version of the proprietary graphics driver for your GPU is a little bit more up-to-date than the version of the same graphics driver that is available from the default Ubuntu repositories. Don't worry about this, because if the difference between version numbers of the two proprietary graphics drivers is small, then you will get similar performance by using either of the two drivers. If you install a graphics driver from the default Ubuntu repositories, you will also get automatic updates for that driver which are sometimes linked to kernel updates.