Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thekalinga/755497d505081caa230f16354bada0b1 to your computer and use it in GitHub Desktop.
Save thekalinga/755497d505081caa230f16354bada0b1 to your computer and use it in GitHub Desktop.
Installing Nvidia Graphics Driver and Cuda on Ubuntu

Installing Nvidia Graphics Driver and Cuda on Ubuntu

Remove any previously installed Nvidia drivers

$ sudo apt-get remove --purge nvidia-*
$ sudo apt-get autoremove
$ sudo apt-get autoclean

You can choose to install CUDA drivers from .deb file or .run file

1. Installing from .run file (Recommended)


Download CUDA 8.0 .run file (local) for Ubuntu - Download Page

eg: Run file (local) for Ubuntu 14.04 (~1.4G)

$ wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run`
$ chmod 755 cuda_8.0.61_375.26_linux-run

Installing the runfile

Login to the Virtual Console (not the Terminal) by pressing Ctrl + Alt + F1 - Enter your username and password

Disable lightdm and other settings

$ sudo /etc/init.d/lightdm stop
$ sudo init 3 
$ sudo apt-get install build-essential
$ echo blacklist nouveau option nouveau modeset=0 |sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf 
$ sudo update-initramfs -u

Start the runfile

$ sudo ./cuda_8.0.61_375.26_linux-run
...
(Scroll through the Terms and Conditions by Pressing Ctrl+D
...
Do you want to Install Nvidia Integrated Drivers? (yes)
Do you want to Install OpenGL? (yes)

**NOTE: If *lightdm* fails to display after login, Restart the whole process by opting (no) for OpenGL**

...
Install X11 config file? (no)
Install cuda? (yes)

Remove old X11 config file

$ sudo rm /etc/X11/xorg.conf

(No need to create new X11 file as during restart, lightdm will create a new file with new drivers configuration)

Reboot the system

$ sudo reboot

After reboot, login to the system and run nvidia-settings to ensure the drivers are installed

$ nvidia-settings
...
$ nvidia-smi
...

2. Installing from .deb file


Download CUDA 8.0 .deb file (local) for Ubuntu - Download Page

eg: Deb file (local) for Ubuntu 14.04 (~1.9G)

$ wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64-deb`

Run the following commands

$ sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64-deb
$ sudo apt-get update
$ sudo apt-get install cuda

Reboot the system

$ sudo reboot

After reboot, login to the system and run nvidia-settings to ensure the drivers are installed

$ nvidia-settings
...
$ nvidia-smi
...

Comment if there any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment