Q. I need kernel headers to compile module and vmware tools. How do I install kernel headers under Debian / Ubuntu Linux.?
A. To install cLinux kernel headers for currently running version, type the following commands at shell prompt (open terminal and type the command):
Make sure you have updated version
$ sudo apt-get update
Search for kernel version (optional)
$ apt-cache search linux-headers-$(uname -r)
Install linux-header package
$ sudo apt-get install linux-headers-$(uname -r)
Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 10-25-07

{ 6 comments… read them below or add one }
this is a great automatic method for this action.
thanks :)
Is there any way of getting this without having the internet on ubuntu? I need it to install a driver for my router from source
Another setting if you are trying to download a different linux header version (for instance, a chrooted environment with different kernel), you can also use this while chrooted.
sudo apt-get install linux-headers-$(`ls /lib/modules`)
this gives accurate header info.
thank you very much, so simple and so helpful solution !! great
Thank you very much, It helped me a lot
i am having a problem with the method discussed above whenever i write the command “sudo apt-get update”.
I get an error message that is “umair is not in the sudoers file. This incident will be reported.”
What do i need to do to get rid of this error message?
I would be obliged if anyone could help me out.
Regards