How To Install kernel-package on Ubuntu 20.04

In this tutorial we learn how to install kernel-package on Ubuntu 20.04. kernel-package is utility for building Linux kernel related Debian packages

Introduction

In this tutorial we learn how to install kernel-package on Ubuntu 20.04.

What is kernel-package

kernel-package is:

This package provides the capability to create a Debian kernel image package by just running make-kpkg kernel_image in a kernel source directory tree. It can also package the relevant kernel headers into a kernel-headers package. In general, this package is very useful if you need to create a custom kernel, if, for example, the default kernel does not support some of your hardware, or you wish a leaner, meaner kernel. It also scripts the steps that need be taken to compile the kernel, which is quite convenient (forgetting a crucial step once was the initial motivation for this package). Please look at /usr/share/doc/kernel-package/Rationale for a full list of advantages of this package.

There are three methods to install kernel-package on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install kernel-package Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install kernel-package using apt-get by running the following command:

sudo apt-get -y install kernel-package

Install kernel-package Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install kernel-package using apt by running the following command:

sudo apt -y install kernel-package

Install kernel-package Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install kernel-package using aptitude by running the following command:

sudo aptitude -y install kernel-package

How To Uninstall kernel-package on Ubuntu 20.04

To uninstall only the kernel-package package we can use the following command:

sudo apt-get remove kernel-package

Uninstall kernel-package And Its Dependencies

To uninstall kernel-package and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove kernel-package

Remove kernel-package Configurations and Data

To remove kernel-package configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge kernel-package

Remove kernel-package configuration, data, and all of its dependencies

We can use the following command to remove kernel-package configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge kernel-package

References

Summary

In this tutorial we learn how to install kernel-package package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.