HowTo: Ubuntu Linux Install Kernel Source Code And Headers

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:
  linux-source-2.6.32
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 

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 7 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
7 comments… add one
  • Divyans Oct 14, 2012 @ 12:52

    Gr8! Thanks..

  • JCD Mar 20, 2013 @ 19:34

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

  • root Apr 16, 2013 @ 14:26

    s/sudp/sudo/

  • dave May 29, 2014 @ 15:20

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

    • doesn't matter Sep 1, 2014 @ 15:16

      you can find those under /usr/src/

  • Umer Apr 22, 2015 @ 18:39

    unable to connect to 10.0.11.21 error while executing apt-get source command

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum