To install the kernel source code and headers on Ubuntu Linux, you can use the apt-get
package manager. Here are the steps to follow:
- Open a terminal window on your Ubuntu machine.
- Update the package list by running the following command:
sudo apt-get update
- Install the kernel source code and headers by running the following command:
sudo apt-get install linux-source linux-headers-$(uname -r)
The linux-source
package will install the kernel source code, and the linux-headers-$(uname -r)
package will install the kernel headers for the currently running kernel.
- Once the installation is complete, you can locate the kernel source code in the
/usr/src/
directory and the kernel headers in the/usr/src/linux-headers-$(uname -r)/
directory.
You can now use the kernel source code and headers to compile and install kernel modules or other kernel-related software.
Note that installing the kernel source code and headers may take up a significant amount of disk space. You can check the disk space usage by running the df -h
command.