1. Lets remove first everything that point to any existing nvidia installation.

open a terminal and type:

sudo apt-get remove nvidia*

sudo apt-get autoremove

2. Update and download a few tools that we will need:

sudo apt-get update

sudo apt-get install dkms build-essential linux-headers-$(uname -r)

3. This part is (optional) but its is recommended:

Install 32 bit support:

dpkg --add-architecture i386

sudo apt-get update

sudo apt-get install lib32z1 lib32ncurses5

sudo apt-get update

4. Now its time to blacklist the nouveau driver.

sudo nano /etc/modprobe.d/blacklist-nouveau.conf

and add the following lines:

blacklist nouveau

blacklist lbm-nouveau

options nouveau modeset=0

alias nouveau off

alias lbm-nouveau off

5. Disable the Kernel nouveau by typing the following commands:

echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf

sudo update-initramfs -u

6. Download Nvidia drivers from nvidia.com and:

cd ~/Downloads/

chmod u+x NVIDIA-Linux-x86_64-361.42.run

7. Stop the X-server:

sudo /etc/init.d/gdm3 stop

8. Execute the installation:

sudo ./ NVIDIA-Linux-x86_64-361.42.run