How To Download, Compile and Install Custom Linux Kernel Manually In Ubuntu, Debian, Mint, Kali, CentOS?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-download-compile-and-install-custom-linux-kernel-manually-in-ubuntu-debian-mint-kali-centos/
PINTEREST
PINTEREST
INSTAGRAM

Linux is a Operating System kernel and user space applications will create different distributions like CentOS, Ubuntu, Mint, Kali around this kernel. Kernel can be downloaded freely and used without any license fee. In this tutorial we will learn how to download Linux Kernel from kernel.org and compiling with GCC . An the last step installing or upgrading the kernel.

Download Kernel Source Code

Kernel source code is originally maintained in the kernel.org . But there are a lot of mirrors which serve to download the kernel source code. In this step we will download kernel source code by using wget command like below. Current stable version of the Linux Kernel is 4.17.6.

Download Kernel Source Code

Download Kernel Source Code

Install GCC and Other Requirements

GCC is most popular compiler for C and C++ source codes in Linux environment. We will use GCC in order to compile and create binaries for Linux Kernel . We will install gcc with the following command for different distributions.

Ubunt, Debian, Mint, Kali:

CentOS, Fedora:

Install GCC and Other Requirements

Install GCC and Other Requirements

Extract Kernel Source Code

Kernel source code has a lot of text type data which may take a lot of disk space and bandwith. So Linux Kernel code is distributed in compressed formats like xz , tar.gz etc. We download Kernel Source code as xz so we need to extract source code  with the tar command like below.

LEARN MORE  How To Get Volume Information of VM in Libvirt

Create Compile Configuration

We will create a configuration which will used to compile required modules and kernel features.

Create Compile Configration

Create Compile Configration

Compile Linux Kernel Source Code with GCC and Make

We will use make command wich will run compile process according to the configuration we have created with the make menuconfig command.

Compile Linux Kernel Source Code with GCC and Make

Compile Linux Kernel Source Code with GCC and Make

Compile Linux Kernel Faster

By default make command will make compile with a single thread . But as modern CPU’s have multiple cores which gives ability to use multiple threads we can run parallel compile with -j option of the make command. In this case we specify 4 threads

Compile Linux Kernel Faster

Compile Linux Kernel Faster

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-download-compile-and-install-custom-linux-kernel-manually-in-ubuntu-debian-mint-kali-centos/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)