红联Linux门户
Linux帮助

在CentOS和Ubuntu 16.04中安装Linux Kernel 4.12

发布时间:2017-07-18 14:58:57来源:Linux公社作者:Linux
Linus Torvalds在7月2日星期天宣布了Linux Kernel 4.12的最终稳定发布。在发行说明中,他提到4.12是历史上较大的版本之一。在本指南中,我们将看到如何在CentOS和Ubuntu操作系统中安装Linux Kernel 4.12。然而,这里提供的步骤将适用于其他基于YUM和基于APT的系统。
 
在CentOS中安装Linux Kernel 4.12
以下步骤在CentOS 7 64位最低版本中进行了测试。 但是,它可能适用于其他RPM发行版,如RHEL,Fedora和Scientific Linux。
最新的内核在官方存储库中不可用。 所以,我们需要添加ELRepo存储库来安装这个最新的内核。
以下步骤应以root用户身份运行。
首先,添加ELRepo GPG密钥,如下所示:
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
然后,使用命令在CentOS 7 / RHEL 7 / Scientific Linux 7中添加ELRepo:
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
为CentOS 6 / RHEL 6 / Scientific Linux 6安装ELRepo:
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
通过安装以下软件包启用ELRepo最快的镜像:
yum install yum-plugin-fastestmirror
我们添加了ELRepo。 现在是安装Linux kernel 4.12的时候了。
以防万一,您想要查看当前安装的内核版本,请运行以下命令:
uname -r
输出如下内容:
3.10.0-514.16.1.el7.x86_64
正如上面的输出,我的CentOS 7测试环境正在运行Linux内核版本3.10.0-514.16.1.el7.x86_64。
接下来,启用ELRepo并使用命令安装Linux Kernel 4.12版本:
yum --enablerepo=elrepo-kernel install kernel-ml
安装内核后,重新启动系统并从Grub启动菜单中选择最新的内核。
在CentOS和Ubuntu 16.04中安装Linux Kernel 4.12
登录系统后,可以验证新安装的内核版本,如下所示。
uname -r
将会输出以下示例:
4.12.0-1.el7.elrepo.x86_64
恭喜!您已经成功更新了Linux内核。 现在,您的系统由最近稳定的Linux Kernel 4.12版本驱动。
如果在安装新的Linux内核后遇到任何问题? 没问题,重启系统。 从引导菜单中选择先前安装的内核。
在CentOS和Ubuntu 16.04中安装Linux Kernel 4.12
然后,使用命令删除新安装的内核:
yum remove kernel-ml
就是这样。
 
在Ubuntu 16.04 LTS中安装Linux Kernel 4.12
在Ubuntu 16.04 LTS服务器中测试以下步骤。 但是,本指南应该可以使用其他的Ubuntu版本,还有Debian,Linux Mint。
要查看当前安装的内核,请运行:
uname -r
示例输出:
4.4.0-34-generic
如您所见,我的Ubuntu 16.04系统正在运行4.4.0-34-generic内核版本。
现在,我们将安装Linux Kernel 4.12。 您可以从以下链接下载最新的内核。
对于64位Ubuntu系统:
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12/linux-headers-4.12.0-041200_4.12.0-041200.201707022031_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12/linux-headers-4.12.0-041200-generic_4.12.0-041200.201707022031_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12/linux-image-4.12.0-041200-generic_4.12.0-041200.201707022031_amd64.deb
对于32位Ubuntu系统:
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12/linux-headers-4.12.0-041200_4.12.0-041200.201707022031_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12/linux-headers-4.12.0-041200-generic_4.12.0-041200.201707022031_i386.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.12/linux-image-4.12.0-041200-generic_4.12.0-041200.201707022031_i386.deb
接下来,使用命令安装Linux Kernel 4.12:
sudo dpkg -i *.deb
样例输出:
Selecting previously unselected package linux-headers-4.12.0-041200.
(Reading database ... 91595 files and directories currently installed.)
Preparing to unpack linux-headers-4.12.0-041200_4.12.0-041200.201707022031_all.deb ...
Unpacking linux-headers-4.12.0-041200 (4.12.0-041200.201707022031) ...
Selecting previously unselected package linux-headers-4.12.0-041200-generic.
Preparing to unpack linux-headers-4.12.0-041200-generic_4.12.0-041200.201707022031_amd64.deb ...
Unpacking linux-headers-4.12.0-041200-generic (4.12.0-041200.201707022031) ...
Selecting previously unselected package linux-image-4.12.0-041200-generic.
Preparing to unpack linux-image-4.12.0-041200-generic_4.12.0-041200.201707022031_amd64.deb ...
Done.
Unpacking linux-image-4.12.0-041200-generic (4.12.0-041200.201707022031) ...
Setting up linux-headers-4.12.0-041200 (4.12.0-041200.201707022031) ...
Setting up linux-headers-4.12.0-041200-generic (4.12.0-041200.201707022031) ...
Setting up linux-image-4.12.0-041200-generic (4.12.0-041200.201707022031) ...
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.12.0-041200-generic /boot/vmlinuz-4.12.0-041200-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.12.0-041200-generic /boot/vmlinuz-4.12.0-041200-generic
update-initramfs: Generating /boot/initrd.img-4.12.0-041200-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.12.0-041200-generic /boot/vmlinuz-4.12.0-041200-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.12.0-041200-generic /boot/vmlinuz-4.12.0-041200-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.12.0-041200-generic /boot/vmlinuz-4.12.0-041200-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.12.0-041200-generic
Found initrd image: /boot/initrd.img-4.12.0-041200-generic
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found linux image: /boot/vmlinuz-4.4.0-22-generic
Found initrd image: /boot/initrd.img-4.4.0-22-generic
done
最后,使用命令更新Grub引导加载程序:
sudo update-grub
样例输出:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.12.0-041200-generic
Found initrd image: /boot/initrd.img-4.12.0-041200-generic
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found linux image: /boot/vmlinuz-4.4.0-22-generic
Found initrd image: /boot/initrd.img-4.4.0-22-generic
done
如果您使用BURG引导加载程序,请运行:
sudo update-burg
重新启动系统并登录到新安装的内核。
检查新的内核是否安装了命令:
uname -r
我的Ubuntu系统的输出示例:
4.12.0-041200-generic
If you have any problems after upgrading to the latest Kernel, force reboot your system, and login to the old Kernel by selecting the ‘Advanced options for Ubuntu’ option from the Boot menu.
如果在升级到最新的内核后遇到任何问题,请强制重新启动系统,并通过从“启动”菜单中选择“Advanced options for Ubuntu’ ”选项登录旧的内核。
在CentOS和Ubuntu 16.04中安装Linux Kernel 4.12
选择没有任何问题的旧内核。
在CentOS和Ubuntu 16.04中安装Linux Kernel 4.12
然后使用命令卸载新的内核:
sudo apt-get remove linux-headers-4.12* linux-image-4.12*
最后,重新启动系统再次登录到旧的内核。
另外,有一个最简单的方式可以升级到类似Ubuntu的系统中最新的内核。如果您不喜欢命令行方式,您可以使用Ubuntu内核升级实用程序轻松升级Ubuntu Linux Mint中的Linux内核。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/32019.html