Saturday, 31 August 2013

Install NVIDIA Proprietary Driver in Kali Linux and Debian wheezy

If you are using Linux and have NVIDIA graphics card then most likely you are using open source NVIDIA driver nouveau. It works quite well, but if you want to use 3D acceleration feature or want to use GPU based applications then you need to install NVIDIA proprietary driver. Here is how to do it. First Install linux headers as those will be required to build nvidia modules. Issue following command at terminal
$ aptitude -r install linux-headers-$(uname -r)
Now install required nvidia components. Following command will install and build nvidia modules, and also disable nouveau module.
$ aptitude install nvidia-kernel-dkms
Now we should create new Xorg server configuration file or modify existing to tell it to load nvidia module. nvidia-xconfig package make this task quite easy, install and execute it.
$ aptitude install nvidia-xconfig
$ nvidia-xconfig
Now reboot and check if system is using nvidia graphics driver. On start of xsession nvidia splash screen should be displayed. You can also confirm it by issuing following commands
First check if system is using glx module.
$ glxinfo | grep -i "direct rendering"
It should output "direct rendering: Yes"
If you do not have glxinfo then first install mesa-utils package then again issue above command and check output
$ aptitude install mesa-utils
Check if nvidia module loaded.
$ lsmod | grep nvidia
If it produces output like 'nvidia      11239499  45' or something similar (numbers could be different at your system) then nvidia module is loaded.
Just to be sure nouveau module NOT loaded, issue following command
$ lsmod | grep nouveau
It should NOT produce any output. If it produces output then something is wrong.
If you are planning to use NVIDIA Graphics Driver just for better disply and 3D rendering then it is almost finished. But if you want to run applications that uses NVIDIA CUDA for processing (like cudahashcat+) then you will also need to install CUDA drivers as below
$ aptitude install nvidia-cuda-toolkit nvidia-opencl-icd
 Now you should be able to use applications designed to utilize GPU.