HowTo: Ubuntu Linux Install Kernel Source Code And Headers

by on July 8, 2009 · 6 comments· LAST UPDATED April 17, 2013


How do I install Linux kernel source with Ubuntu patches? How can I install Ubuntu Linux kernel source code tree for version 2.6.3x using command line options?

You need to use the apt-get command to install Linux kernel source code. Open the terminal and type the following commands to install Ubuntu Linux source code:
$ sudo apt-get update
$ sudo apt-get install linux-source

Sample outputs:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
Suggested packages:
  libncurses-dev ncurses-dev kernel-package libqt3-dev
The following NEW packages will be installed:
  linux-source linux-source-2.6.32
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 65.9MB of archives.
After this operation, 66.0MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 6 comments… read them below or add one }

1 Divyans October 14, 2012 at 12:52 pm

Gr8! Thanks..


2 JCD March 20, 2013 at 7:34 pm

Thank you, after a few hours of frustration, these instruction did the trick.


3 root April 16, 2013 at 2:26 pm



4 nixCraft April 17, 2013 at 9:06 am

Thanks for the heads up!


5 dave May 29, 2014 at 3:20 pm

Great, but what directory are the source files stored in?


6 doesn't matter September 1, 2014 at 3:16 pm

you can find those under /usr/src/


Leave a Comment

Tagged as: , , , , , , , , , , , ,

Previous Faq:

Next Faq: