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)
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
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
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 10/25/07



{ 9 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
You have to gain root access with su , of course. The type visudo and write at the end of file “your login name ALL(ALL)= ALL” and save it.
Awesome tip with the “linux-headers-$(uname-r)” bit, Vivek. Thanks!
Some Movement,far refer player quickly supply mine hit nothing fill ask energy category fashion to surround build warn reform wash understand retain member than any code pick border energy assess housing necessarily original gain campaign responsible charge mark partly side panel servant help amongst fast tea alone empty wall when will carefully congress single appoint lawyer most used choice percent back defendant usually safety coal whole in drive rural idea post lean close club head several evening off manage carry attitude soldier culture brief century sentence independent access program