How to install Kernel Headers in Kali Linux 2/Kali Sana - Cyber Programmers - Learn Programming

Breaking

Monday, August 24, 2015

How to install Kernel Headers in Kali Linux 2/Kali Sana

When you install a Linux on your computer the first thing you need to do is update it and install the kernel headers. For example, Ubuntu installs kernel headers when you update it. But for Kali Linux users it's different, you need to install the kernel headers manually. If you are running Kali on VMware player/workstation or on VirtualBox then you need to install the kernel headers to be able to install the VMware tools or VB guest additions correctly.

Also Read: How to Fix Sound/Audio Driver Mute in Kali Linux 2/Kali Sana on Boot

1) Make sure you are logged in as a root, but if you are logged in as a user with administrative permissions then add a sudo before every command. 
2) Simply open up the terminal and execute next commands:
apt-get update
apt-get install linux-headers-$(uname -r)
3) Now you can check if the kernel headers are installed correctly by checking it's version with next command:
uname -r
If you get a version of headers it means the kernel headers are installed successfully.
If you get some errors at installation time and the kernel headers are still not installed in your Kali then simply check the sources.list file.
To do that open up the terminal and execute next command:
leafpad /etc/apt/sources.list
You can change the leafpad with your favorite editor.
It will open up the sources.list file.
Make sure it includes all default and important repositories:
deb http://http.kali.org/kali sana main non-free contrib
deb http://security.kali.org/kali-security sana/updates main contrib non-free
deb-src http://http.kali.org/kali sana main non-free contrib
deb-src http://security.kali.org/kali-security sana/updates main contrib non-free
If above lines don't exists in your sources.list file then simply add them. Save the file and close it. You can also get the latest source file repositories from here.
After all, try again to execute all command from the second step. If doesn't work try to restart the Kali and try again.