How to install the latest/stable version of Linux kernel on Ubuntu Linux using apt-get

I read your tutorial about compiling a stable version of the Linux kernel on a Ubuntu/Debian Linux . I wanted to install the same using apt-get command. How can I install the latest (mainline) Linux kernel on Ubuntu Linux?

Installing a brand new kernel on server or desktop is not recommended. The latest version might be buggy and can crash your system. However, if you need the latest version try the following instructions.

Method #1: Search and install the latest stable version

I tested this method on the following version of Ubuntu:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.2 LTS
Release:	16.04
Codename:	xenial

To find out your current version of Linux kernel , run:

$ uname -mrs
Linux 4.4.0-83-generic x86_64

To find out the latest version of Linux kernel type:

$ apt-cache search linux-generic

Sample outputs:

linux-generic - Complete Generic Linux kernel and headers
linux-generic-lts-utopic - Complete Generic Linux kernel and headers (dummy transitional package)
linux-generic-lts-vivid - Complete Generic Linux kernel and headers (dummy transitional package)
linux-generic-lts-wily - Complete Generic Linux kernel and headers (dummy transitional package)
linux-generic-lts-xenial - Complete Generic Linux kernel and headers (dummy transitional package)
linux-image-4.4.0-21-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
linux-image-extra-4.4.0-21-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
linux-generic-hwe-16.04 - Complete Generic Linux kernel and headers
linux-generic-hwe-16.04-edge - Complete Generic Linux kernel and headers
linux-image-4.10.0-14-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
linux-image-4.10.0-19-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
linux-image-4.10.0-20-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
linux-image-4.10.0-21-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
linux-image-4.10.0-22-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
linux-image-4.10.0-24-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
linux-image-4.10.0-26-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
linux-image-4.10.0-27-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
linux-image-4.4.0-22-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
linux-image-4.4.0-24-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
linux-image-4.4.0-28-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
linux-image-4.4.0-31-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP

The highest possible version is 4.10.0-27. To install it just type the followingapt-get command/ apt command :

$ sudo apt install linux-image-4.10.0-27-generic

OR

$ sudo apt-get install linux-image-4.10.0-27-generic

Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-81 linux-headers-4.4.0-81-generic linux-image-4.4.0-81-generic
Use 'apt autoremove' to remove them.
Suggested packages:
  fdutils linux-tools linux-headers-4.10.0-27-generic
The following NEW packages will be installed:
  linux-image-4.10.0-27-generic
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/20.1 MB of archives.
After this operation, 70.0 MB of additional disk space will be used.
Selecting previously unselected package linux-image-4.10.0-27-generic.
(Reading database ... 89746 files and directories currently installed.)
Preparing to unpack .../linux-image-4.10.0-27-generic_4.10.0-27.30~16.04.2_amd64.deb ...
Done.
Unpacking linux-image-4.10.0-27-generic (4.10.0-27.30~16.04.2) ...
Setting up linux-image-4.10.0-27-generic (4.10.0-27.30~16.04.2) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-27-generic /boot/vmlinuz-4.10.0-27-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-27-generic /boot/vmlinuz-4.10.0-27-generic
update-initramfs: Generating /boot/initrd.img-4.10.0-27-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.10.0-27-generic /boot/vmlinuz-4.10.0-27-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.10.0-27-generic /boot/vmlinuz-4.10.0-27-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.0-27-generic /boot/vmlinuz-4.10.0-27-generic
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-4.4.0-83-generic
Found kernel: /vmlinuz-4.4.0-81-generic
Found kernel: /vmlinuz-4.10.0-27-generic
Found kernel: /vmlinuz-4.4.0-83-generic
Found kernel: /vmlinuz-4.4.0-81-generic
Replacing config file /run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done

You must reboot the Linux server, run:

$ rm *.deb
 $ sudo reboot

Verify new version:

$ uname -mrs
Linux 4.10.0-27-generic x86_64

Method #2: Install mainline kernel version v4.12.3

First visit kernel.org and note down the latest kernel version:

Fig.01: Note down kernel version

Next visit the following url and search for the Linux kernel version 4.12.3

http://kernel.ubuntu.com/~kernel-ppa/mainline/

Fig.02: Downloading the latest build of mainline kernel

Use the wget command to grab the files:

$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12.3/linux-headers-4.12.3-041203-generic_4.12.3-041203.201707210343_amd64.deb
 $ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12.3/linux-image-4.12.3-041203-generic_4.12.3-041203.201707210343_amd64.deb

Install it using dpkg command:

$ sudo dpkg -i *.deb

You must reboot the Linux server, run:

$ sudo reboot

Verify new version:

$ uname -mrs
Linux 4.12.3-041203-generic x86_64

A note about updating mainline kernel

You must visit and download the latest version from the following url:

http://kernel.ubuntu.com/~kernel-ppa/mainline/

For example, download v4.13-rc1 as follows:

$ rm *.deb
 $ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13-rc1/linux-headers-4.13.0-041300rc1-generic_4.13.0-041300rc1.201707151931_amd64.deb
 $ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13-rc1/linux-image-4.13.0-041300rc1-generic_4.13.0-041300rc1.201707151931_amd64.deb
 $ sudo dpkg -i *.deb
 $ sudo reboot
 $ uname -mrs

This entry is
2 of
2 in the
Installing Mainline Linux Kernel on a Ubuntu/Debian series. Keep reading the rest of the series:

  1. How to Compile and Install Linux Kernel From Source Code
  2. How to install mainline Linux kernel on Ubuntu Linux

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter , Facebook , Google+ .

nixCraft稿源:nixCraft (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » How to install the latest/stable version of Linux kernel on Ubuntu Linux using apt-get

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录