Debian / Ubuntu linux install kernel headers package

by Vivek Gite · 9 comments

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:

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!

{ 9 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

7 gaspar 07.07.09 at 8:53 pm

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.

8 cparker 08.10.09 at 3:04 pm

Awesome tip with the “linux-headers-$(uname-r)” bit, Vivek. Thanks!

9 Clearlyarrive 12.08.09 at 9:05 pm

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

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>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All