Debian / Ubuntu linux install kernel headers package

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!

{ 6 comments… read them below or add one }

1 plasmafusion 03.27.08 at 2:33 pm

this is a great automatic method for this action.
thanks :)

2 Jack 07.04.08 at 5:57 pm

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

3 Jerry 11.11.08 at 7:03 pm

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.

4 davek 03.04.09 at 9:25 pm

thank you very much, so simple and so helpful solution !! great

5 Ofir 03.21.09 at 6:53 pm

Thank you very much, It helped me a lot

6 umair 06.21.09 at 10:16 pm

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

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , ,

Previous post: Find out my Linux distribution name and version

Next post: Zipping a directory in Linux terminal