Rather than using an outdated Ubuntu which seems to be the current suggestions, this is what I used with Debian. This will get you the latest Debian (Jessie), latest kernel (4.9) and the 7.6.33 BOINC client. You should be up and running with a CUDA and OpenCL capable machine after doing this.
Part 1 - Install Debian
I used the Debian 8.7 net install for this. You’ll need a thumb drive or a blank CD. Download Debian from http://www.debian.org/distrib/ and write the ISO image to CD or thumb drive.
Boot off the thumb drive or CD. It will start up the Debian installer
Install Debian. It will ask a bunch of questions like language, country, etc and prompt for partitioning your disks. When it asks for software to install select SSH server and whatever desktop you prefer and remove all other selections. Once done it will prompt for a reboot.
Part 2 - Install Nvidia software
Login as root, open a xterm window and type the following commands:
nano sources.list (nano is a text editor)
Change “jessie main” lines to “jessie main contrib non-free” and add a jessie-backports line. It should look like this when you're done. I'm using httpredir as it will pick the fastest server.
deb http://httpredir.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://httpredir.debian.org/debian/ jessie-updates main contrib non-free
deb http://httpredir.debian.org/debian/ jessie-backports main contrib non-free
Exit out of nano and save the file (Control-O followed by Control-X)
apt install –t jessie-backports firmware-realtek (if needed). Most of my motherboards have Realtek chips.
apt install –t jessie-backports linux-image-amd64
apt install –t jessie-backports nvidia-kernel-dkms nvidia-smi nvidia-xconfig
apt install –t jessie-backports nvidia-opencl-icd (if you want OpenCL support)
Part 3 – Install BOINC
apt install –t jessie-backports boinc-nvidia-cuda boinc-manager