I personally recommend you follow this. This is absolutely a time saver for installing these graphics drivers.
Source of this info: here
Install NVIDIA Graphics Driver via runfile
Initially remove all the previous Nvidia drivers (Important)
sudo apt-get purge nvidia*
# Note this might remove your cuda installation as well
sudo apt-get autoremove
Download the required driver from Nvidia website
Install dependenices
For Ubuntu, installing the following dependencies is enough.
1) build-essential
-- For building the driver
2) (Optional) gcc-multilib -- For providing 32-bit support
3) dkms
-- For providing dkms support
As a summary, All the above packages can be installed using this command sudo apt-get install build-essential gcc-multilib dkms
Create Backlist for Nouveau driver
Create a file at /etc/modprobe.d/blacklist-nouveau.conf
with the following contents:
blacklist nouveau
options nouveau modeset=0
Then,
for Ubuntu 14.04 LTS, reboot the computer;
for Ubuntu 16.04 LTS, excute sudo update-initramfs -u
and reboot the computer;
Stop lightdm/gdm/kdm
After the computer is rebooted. We need to stop the desktop manager before excuting the runfile to install the driver. lightdm
is the default desktop manager in Ubuntu. If GNOME or KDE desktop environment is used, installed desktop manager will then be gdm
or kdm
.
For Ubuntu 14.04 / 16.04, excuting sudo service lightdm sto
p (or use gdm or kdm instead of lightdm)
For Ubuntu 16.04, excuting sudo systemctl stop lightdm
(or use gdm or kdm instead of lightdm)
Excuting the Runfile
Enter the tty and enter these commands to execute the file
cd ~
chmod +x NVIDIA-Linux-x86_64-384.69.run
sudo ./NVIDIA-Linux-x86_64-384.69.run --dkms -s
These errors can be safe to ignore
WARNING: nvidia-installer was forced to guess the X library path '/usr/lib' and X module path '/usr/lib/xorg/modules'; these paths were not queryable from the system. If X fails to find the NVIDIA X driver module, please install the `pkg-config` utility and the X.Org SDK/development package for your distribution and reinstall the driver.
Check the Installation
After a succesful installation, nvidia-smi
command will report all your CUDA-capable devices in the system.
Hope this helps