Skip to content Skip to main navigation Skip to footer

Ubuntu 下安装最新稳定版Linux内核kernel

本文将会讲述如何在Ubuntu 16.04 LTS 系统下安装最新版的linux内核。 在安装最新版内核前,需要需要考虑系统宕机风险,所以通常情况下,我们最好安装最新的稳定版本。
下面我们通过两种方法来在ubuntu系统下安装最新版的linux内核。

方法一:通过apt安装最新linux版本内核

1# 查看当前系统的linux内核版本

执行下面的命令:

$uname -mrs

命令输出如下:

Linux 4.4.0-62-generic x86_64

2# 查看当前可用的最新版本的linux 内核

执行下面的命令:

$ apt-cache search linux-generic

命令输出如下:

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.10.0-28-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
 linux-image-4.10.0-30-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
 linux-image-4.10.0-32-generic - Linux kernel image for version 4.10.0 on 64 bit x86 SMP
 linux-image-4.11.0-13-generic - Linux kernel image for version 4.11.0 on 64 bit x86 SMP
 linux-image-4.11.0-14-generic - Linux kernel image for version 4.11.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
 linux-image-4.4.0-34-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-36-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-38-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-42-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-43-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-45-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-47-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-51-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-53-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-57-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-59-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-62-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-63-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-64-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-66-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-67-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-70-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-71-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-72-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-75-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-77-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-78-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-79-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-81-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-83-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-87-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-89-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-91-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.4.0-92-generic - Linux kernel image for version 4.4.0 on 64 bit x86 SMP
 linux-image-4.8.0-34-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-36-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-39-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-41-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-42-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-44-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-45-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-46-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-49-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-51-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-52-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-53-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-54-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-56-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-4.8.0-58-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-14-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-19-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-20-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-21-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-22-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-24-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-26-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-27-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-28-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-30-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.10.0-32-generic - Linux kernel extra modules for version 4.10.0 on 64 bit x86 SMP
 linux-image-extra-4.11.0-13-generic - Linux kernel extra modules for version 4.11.0 on 64 bit x86 SMP
 linux-image-extra-4.11.0-14-generic - Linux kernel extra modules for version 4.11.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-22-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-24-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-28-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-31-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-34-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-36-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-38-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-42-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-43-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-45-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-47-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-51-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-53-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-57-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-59-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-62-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-63-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-64-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-66-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-67-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-70-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-71-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-72-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-75-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-77-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-78-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-79-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-81-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-83-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-87-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-89-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-91-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.4.0-92-generic - Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-34-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-36-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-39-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-41-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-42-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-44-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-45-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-46-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-49-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-51-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-52-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-53-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-54-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-56-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP
 linux-image-extra-4.8.0-58-generic - Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP

从上面的命令输出中我们可以看到,当前的最新版本号是4.11.0-14

3# 安装最新的linux内核 4.11.0-14

执行下面命令:

$ sudo apt-get install linux-image-4.11.0-14-generic

命令输出如下:

正在读取软件包列表... 完成
 正在分析软件包的依赖关系树
 正在读取状态信息... 完成
 下列软件包是自动安装的并且现在不需要了:
 gyp javascript-common libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore libnvpair1linux libssl-dev libssl-doc libuutil1linux libuv1-dev
 libzfs2linux libzpool2linux python-pkg-resources zfs-doc zlib1g-dev
 使用'apt autoremove'来卸载它(它们)。
 建议安装:
 fdutils linux-tools linux-headers-4.11.0-14-generic
 下列【新】软件包将被安装:
 linux-image-4.11.0-14-generic
 升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 5 个软件包未被升级。
 需要下载 20.4 MB 的归档。
 解压缩后会消耗 70.7 MB 的额外空间。
 获取:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-image-4.11.0-14-generic amd64 4.11.0-14.20~16.04.1 [20.4 MB]
 已下载 20.4 MB,耗时 22秒 (894 kB/s)
 正在选中未选择的软件包 linux-image-4.11.0-14-generic。
 (正在读取数据库 ... 系统当前共安装有 67751 个文件和目录。)
 正准备解包 .../linux-image-4.11.0-14-generic_4.11.0-14.20~16.04.1_amd64.deb  ...
 Done.
 正在解包 linux-image-4.11.0-14-generic (4.11.0-14.20~16.04.1) ...
 正在设置 linux-image-4.11.0-14-generic (4.11.0-14.20~16.04.1) ...
 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.11.0-14-generic /boot/vmlinuz-4.11.0-14-generic
 run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.11.0-14-generic /boot/vmlinuz-4.11.0-14-generic
 update-initramfs: Generating /boot/initrd.img-4.11.0-14-generic
 W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
 run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.11.0-14-generic /boot/vmlinuz-4.11.0-14-generic
 run-parts: executing /etc/kernel/postinst.d/update-notifier 4.11.0-14-generic /boot/vmlinuz-4.11.0-14-generic
 run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.11.0-14-generic /boot/vmlinuz-4.11.0-14-generic
 Generating grub configuration file ...
 Found linux image: /boot/vmlinuz-4.11.0-14-generic
 Found initrd image: /boot/initrd.img-4.11.0-14-generic
 Found linux image: /boot/vmlinuz-4.4.0-62-generic
 Found initrd image: /boot/initrd.img-4.4.0-62-generic
 done

4# 重启ubuntu 系统

$ sudo reboot

5# 查看当前系统的最新linux内核版本

$ uname -mrs

方法二:通过下载最新内核deb包安装内核

1# 首先访问kernel.org 官方网站确定当前最新的稳定版本号
2# 从ubuntu kernel官方下载该版本kernel http://kernel.ubuntu.com/~kernel-ppa/mainline/
使用wget命令来下载内核deb包:

$wget  http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12.8/linux-image-4.12.8-041208-generic_4.12.8-041208.201708161815_amd64.deb
$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12.8/linux-headers-4.12.8-041208_4.12.8-041208.201708161815_all.deb

3# 安装下载的.deb包

$ sudo dpkg -i *.db

4# 重启系统

$ sudo reboot