mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Complete tranlation of 20190107 Different Ways To Update Linux Kernel For Ubuntu.md
This commit is contained in:
parent
9cf014af0a
commit
dc0da89287
@ -1,69 +1,68 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (mr-ping)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Different Ways To Update Linux Kernel For Ubuntu)
|
||||
[#]: via: (https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/)
|
||||
[#]: author: (SK https://www.ostechnix.com/author/sk/)
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "mr-ping"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: subject: "Different Ways To Update Linux Kernel For Ubuntu"
|
||||
[#]: via: "https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/"
|
||||
[#]: author: "SK https://www.ostechnix.com/author/sk/"
|
||||
|
||||
Different Ways To Update Linux Kernel For Ubuntu
|
||||
|
||||
升级Ubuntu Linux核心的几种不同方法
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2019/01/ubuntu-linux-kernel-720x340.png)
|
||||
|
||||
In this guide, we have given 7 different ways to update Linux kernel for Ubuntu. Among the 7 methods, five methods requires system reboot to apply the new Kernel and two methods don’t. Before updating Linux Kernel, it is **highly recommended to backup your important data!** All methods mentioned here are tested on Ubuntu OS only. We are not sure if they will work on other Ubuntu flavors (Eg. Xubuntu) and Ubuntu derivatives (Eg. Linux Mint).
|
||||
这个指南里介绍了7种为Ubuntu升级Linux核心的不同方法。这7种方法里,有5种需要重启系统来使新核心生效,其他两种则不用。升级之前,**强烈建议您将重要数据进行备份!** 这里提到的所有方法只在Ubuntu中测试过。我们并不确定这些方法是不是也能适用于其他Ubuntu的特色发行版(如:Xubuntu)和衍生发行版(如:Linux Mint)。
|
||||
|
||||
### Part A – Kernel Updates with reboot
|
||||
### 第一部分: 需要重启的核心升级
|
||||
|
||||
The following methods requires you to reboot your system to apply the new Linux Kernel. All of the following methods are recommended for personal or testing systems. Again, please backup your important data, configuration files and any other important stuff from your Ubuntu system.
|
||||
以下方法需要您重启系统以便新的核心生效。所有方法都建议在个人系统或测试系统中进行。重要的事儿再说一遍,请备份好您Ubuntu中的重要数据、配置文件和其他重要的东西。
|
||||
|
||||
#### Method 1 – Update the Linux Kernel with dpkg (The manual way)
|
||||
### 方法1 - 使用dpkg升级Linux核心(手动方式)
|
||||
|
||||
This method helps you to manually download and install the latest available Linux kernel from **[kernel.ubuntu.com][1]** website. If you want to install most recent version (either stable or release candidate), this method will help. Download the Linux kernel version from the above link. As of writing this guide, the latest available version was **5.0-rc1** and latest stable version was **v4.20**.
|
||||
这个方法里会帮助你手动从**[kernel.ubuntu.com][1]**网站下载可用的最新Linux核心。如果你打算安装最新版(而不是稳定版或者正式发布版),那这种方法对你会很有用。从以上链接下载Linux核心版本。编写这个指南的时候,最新的可用版本是**5.0-rc1**,最新的稳定版是**v4.20**.
|
||||
|
||||
![][3]
|
||||
|
||||
Click on the Linux Kernel version link of your choice and find the section for your architecture (‘Build for XXX’). In that section, download the two files with these patterns (where X.Y.Z is the highest version):
|
||||
基于你的选择,点击相应的Linux核心版本链接,找到你对应的架构(‘Build for XXX’)的那部分。然后下载符合以下格式的两个文件(其中 X.Y.Z 是最高版本号):
|
||||
|
||||
1. linux-image-*X.Y.Z*-generic-*.deb
|
||||
2. linux-modules-X.Y.Z*-generic-*.deb
|
||||
|
||||
|
||||
|
||||
In a terminal, change directory to where the files are and run this command to manually install the kernel:
|
||||
在终端中修改文件所在的目录,然后执行命令,手动安装核心:
|
||||
|
||||
```
|
||||
$ sudo dpkg --install *.deb
|
||||
```
|
||||
|
||||
Reboot to use the new kernel:
|
||||
重启系统,使用新核心:
|
||||
|
||||
```
|
||||
$ sudo reboot
|
||||
```
|
||||
|
||||
Check the kernel is as expected:
|
||||
检查是否如你所愿:
|
||||
|
||||
```
|
||||
$ uname -r
|
||||
```
|
||||
|
||||
For step by step instructions, please check the section titled under “Install Linux Kernel 4.15 LTS On DEB based systems” in the following guide.
|
||||
对于分步的说明,请查看以下名为“Install Linux Kernel 4.15 LTS On DEB based systems”的文章。
|
||||
|
||||
+ [Install Linux Kernel 4.15 In RPM And DEB Based Systems](https://www.ostechnix.com/install-linux-kernel-4-15-rpm-deb-based-systems/)
|
||||
|
||||
The above guide is specifically written for 4.15 version. However, all the steps are same for installing latest versions too.
|
||||
以上的指南是针对的是4.15版本,不过安装最新版本的所有的步骤都是一样的。
|
||||
|
||||
**Pros:** No internet needed (You can download the Linux Kernel from any system).
|
||||
**优势:** 不必联网(你可以从任何系统中下载Linux核心来使用)
|
||||
|
||||
**Cons:** Manual update. Reboot necessary.
|
||||
**缺点:** 手动更新,需要重启系统。
|
||||
|
||||
#### Method 2 – Update the Linux Kernel with apt-get (The recommended method)
|
||||
#### 方法2 - 用apt-get来升级Linux核心(推荐方法)
|
||||
|
||||
This is the recommended way to install latest Linux kernel on Ubuntu-like systems. Unlike the previous method, this method will download and install latest Kernel version from Ubuntu official repositories instead of **kernel.ubuntu.com** website..
|
||||
这是在类Ubuntu系统中升级Linux核心的推荐方法。不同于上一个方法,这种方法会从Ubuntu官方仓库下载、安装核心版本而不是从 **kernel.ubuntu.com**网站。
|
||||
|
||||
To update the whole system including the Kernel, just do:
|
||||
要升级包括核心的整个系统,只需要执行:
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
@ -71,87 +70,84 @@ $ sudo apt-get update
|
||||
$ sudo apt-get upgrade
|
||||
```
|
||||
|
||||
If you want to update the Kernel only, run:
|
||||
如果只希望升级核心,运行:
|
||||
|
||||
```
|
||||
$ sudo apt-get upgrade linux-image-generic
|
||||
```
|
||||
|
||||
**Pros:** Simple. Recommended method.
|
||||
**优势:** 简单。推荐方法。
|
||||
|
||||
**Cons:** Internet necessary. Reboot necessary.
|
||||
**缺点:** 需要联网,需要重启。
|
||||
|
||||
Updating Kernel from official repositories will mostly work out of the box without any problems. If it is the production system, this is the recommended way to update the Kernel.
|
||||
从官方库中升级核心是最接近开箱即用的方法,并且不会出什么问题。如果是生产环境的系统,这是最为推荐的升级Linux核心的方法。
|
||||
|
||||
Method 1 and 2 requires user intervention to update Linux Kernels. The following methods (3, 4 & 5) are mostly automated.
|
||||
方法1和方法2都需要用户去介入到升级Linux核心的过程中。而下边的方法(3、 4、 5)则几乎是全自动的。
|
||||
|
||||
#### Method 3 – Update the Linux Kernel with Ukuu
|
||||
#### 方法3 - 使用Ukuu升级Linux核心
|
||||
|
||||
**Ukuu** is a Gtk GUI and command line tool that downloads the latest main line Linux kernel from **kernel.ubuntu.com** , and install it automatically in your Ubuntu desktop and server editions. Ukku is not only simplifies the process of manually downloading and installing new Kernels, but also helps you to safely remove the old and unnecessary Kernels. For more details, refer the following guide.
|
||||
**Ukuu**是一个用于从**kernel.ubuntu.com**下载Linux核心,并且将其自动安装到Ubuntu桌面系统和服务器系统中的Gtk图形化界面和命令行工具。Ukku并不是单单简化了手动下载、安装新核心的过程,同时也会帮助你移除旧的和不再需要的核心。更多细节可以参照以下指南。
|
||||
|
||||
+ [Ukuu – An Easy Way To Install And Upgrade Linux Kernel In Ubuntu-based Systems](https://www.ostechnix.com/ukuu-an-easy-way-to-install-and-upgrade-linux-kernel-in-ubuntu-based-systems/)
|
||||
|
||||
**Pros:** Easy to install and use. Automatically installs main line Kernel.
|
||||
**优势:** 易于安装使用。自动安装主线核心。
|
||||
|
||||
**Cons:** Internet necessary. Reboot necessary.
|
||||
**缺点:** 需要联网,需要重启。
|
||||
|
||||
#### Method 4 – Update the Linux Kernel with UKTools
|
||||
#### 方法4 - 使用UKTools升级Linux核心
|
||||
|
||||
Just like Ukuu, the **UKTools** also fetches the latest stable Kernel from from **kernel.ubuntu.com** site and installs it automatically on Ubuntu and its derivatives like Linux Mint. More details about UKTools can be found in the link given below.
|
||||
跟Ukuu差不多,**UKTools**也会从**kernel.ubuntu.com**网站获取最新的核心并且自动安装到Ubuntu以及类似于Linux Mint的延伸发行版中。
|
||||
|
||||
+ [UKTools – Upgrade Latest Linux Kernel In Ubuntu And Derivatives](https://www.ostechnix.com/uktools-upgrade-latest-linux-kernel-in-ubuntu-and-derivatives/)
|
||||
|
||||
**Pros:** Simple. Automated.
|
||||
**优势:** 简单,自动
|
||||
|
||||
**Cons:** Internet necessary. Reboot necessary.
|
||||
**缺点:** 需要联网,需要重启。
|
||||
|
||||
#### Method 5 – Update the Linux Kernel with Linux Kernel Utilities
|
||||
#### 方法5 - 使用Linux核心工具集(Linux Kernel Utilities)安装Linux核心
|
||||
|
||||
**Linux Kernel Utilities** is yet another program that makes the process of updating Linux kernel easy in Ubuntu-like systems. It is actually a set of BASH shell scripts used to compile and/or update latest Linux kernels for Debian and derivatives. It consists of three utilities, one for manually compiling and installing Kernel from source from [**http://www.kernel.org**][4] website, another for downloading and installing pre-compiled Kernels from from **<https://kernel.ubuntu.com>** website. and third script is for removing the old kernels. For more details, please have a look at the following link.
|
||||
**Linux Kernel Utilities**是目前另一个用于升级类Ubuntu系统Linux核心的程序。实质上,它是一个由一系列Bash脚本构成的合集,用于编译并且可以选择性地为Debian(译者注:Ubuntu的上游发行版)及其衍生发行版升级核心。它包含三个工具集,一个用于手动编译、安装来自于 [**http://www.kernel.org**][4] 网站的源码核心,另一个用于安装来自**<https://kernel.ubuntu.com>**网站的事先编译好的核心,第三个脚本用于移除旧核心。更多细节请浏览以下链接。
|
||||
|
||||
+ [Linux Kernel Utilities – Scripts To Compile And Update Latest Linux Kernel For Debian And Derivatives](https://www.ostechnix.com/linux-kernel-utilities-scripts-compile-update-latest-linux-kernel-debian-derivatives/)
|
||||
|
||||
**Pros:** Simple. Automated.
|
||||
**优势:** 简单,自动
|
||||
|
||||
**Cons:** Internet necessary. Reboot necessary.
|
||||
**缺点:** 需要联网,需要重启。
|
||||
|
||||
### 第二部分 – Kernel Updates without reboot
|
||||
|
||||
### Part B – Kernel Updates without reboot
|
||||
我之前说过,上边所有的方法都需要你去重启服务器(译者注:也可以是桌面版)来启用新核心。如果是个人系统或者测试系统,可以这么办。但对于无法停机的生产环境系统该怎么办呢?一点问题没有,这时候**实时补丁(livepatching)**就派上用场了。
|
||||
|
||||
As I already said, all of above methods need you to reboot the server before the new kernel is active. If they are personal systems or testing machines, you could simply reboot and start using the new Kernel. But, what if they are production systems that requires zero downtime? No problem. This is where **Livepatching** comes in handy!
|
||||
**实时补丁**(或者叫热补丁)允许你在不需要重启的情况下安装Linux升级或补丁来保证你的服务器处于最新的安全等级之下。这对web主机、游戏服务器这类需要不间断在线的服务器来说是很有价值的。事实上,任何情况下,服务器都应该保持在不间断运行的状态下。由于Linux供应商只会在出于修复安全漏洞的目的下维护补丁,所以如果安全性是你的点,这种方式再适合不过了。
|
||||
|
||||
The **livepatching** (or hot patching) allows you to install Linux updates or patches without rebooting, keeping your server at the latest security level, without any downtime. This is attractive for ‘always-on’ servers, such as web hosts, gaming servers, in fact, any situation where the server needs to stay on all the time. Linux vendors maintain patches only for security fixes, so this approach is best when security is your main concern.
|
||||
以下两种方法可以在不需要重启的情况下为生产环境和执行关键任务的Ubuntu服务器更新Linux核心。
|
||||
|
||||
The following two methods doesn’t require system reboot and useful for updating Linux Kernel on production and mission-critical Ubuntu servers.
|
||||
|
||||
#### Method 6 – Update the Linux Kernel Canonical Livepatch Service
|
||||
#### 方法6 – 使用Canonical实时补丁服务(Canonical Livepatch Service)来更新Linux核心
|
||||
|
||||
![][5]
|
||||
|
||||
[**Canonical Livepatch Service**][6] applies Kernel updates, patches and security hotfixes automatically without rebooting the Ubuntu systems. It reduces the Ubuntu systems downtime and keep them secure. Canonical Livepatch Service can be set up either during or after installation. If you are using desktop Ubuntu, the Software Updater will automatically check for kernel patches and notify you. In a console-based system, it is up to you to run apt-get update regularly. It will install kernel security patches only when you run the command “apt-get upgrade”, hence is semi-automatic.
|
||||
[**Canonical Livepatch Service**][6] 可以在不需要重启Ubuntu系统的情况下执行核心升级、补丁和安全的热修复等操作,在减少服务器宕机的情况下保障其安全。Canonical Livepatch Service 可以在安装过程当中或安装之后尽心设置. 如果你使用的是Ubuntu桌面版,软件更新器会自动检查核心补丁的更新,并且通知你。在基于控制台的系统中,则需要你主动运行apt-get update命令来进行升级。由于需要你手动运行“apt-get upgrade”命令它才会安装核心的安全补丁,所以算是半自动的。
|
||||
|
||||
Livepatch is free for three systems. If you have more than three, you need to upgrade to enterprise support solution named **Ubuntu Advantage** suite. This suite includes **Kernel Livepatching** and other services such as,
|
||||
Livepatch对三个及以下系统免费,如果多于三个,你需要升级成名为**Ubuntu Advantage**的企业支持方案套件。这个套件包括**Kernel Livepatching**及以下服务:
|
||||
|
||||
* Extended Security Maintenance – critical security updates after Ubuntu end-of-life.
|
||||
* Landscape – the systems management tool for using Ubuntu at scale.
|
||||
* Knowledge Base – A private collection of articles and tutorials written by Ubuntu experts.
|
||||
* Phone and web-based support.
|
||||
* Extended Security Maintenance – Ubuntu生命周期后的重要安全更新
|
||||
* Landscape – 针对大规模使用Ubuntu的系统管理工具
|
||||
* Knowledge Base – 由Ubuntu专家撰写的私人文章和教程
|
||||
* 电话和网站支持
|
||||
|
||||
**价格**
|
||||
|
||||
Ubuntu Advantage包含三种付费计划, 必备(Essential), 标准(Standard)和 高级(Advanced).最基础的计划(Essential 计划)从 **单物理节点 225 美元/年**和**单VPS 75美元/年**开始计价。看上去应该不支持针对Ubuntu服务器版和桌面版的按月订阅。你可以在 [**此处**][7]浏览所有计划的细节信息。
|
||||
|
||||
**Cost**
|
||||
**优势:** 简单。半自动化。无需重启。支持三个免费系统。
|
||||
|
||||
Ubuntu Advantage includes three paid plans namely, Essential, Standard and Advanced. The basic plan (Essential plan) starts from **225 USD per year for one physical node** and **75 USD per year for one VPS**. It seems there is no monthly subscription for Ubuntu servers and desktops. You can view detailed information on all plans [**here**][7].
|
||||
**缺点:** 4个以上主机的话非常昂贵. 没有补丁回滚。
|
||||
|
||||
**Pros:** Simple. Semi-automatic. No reboot necessary. Free for 3 systems.
|
||||
**开启 Canonical Livepatch Service**
|
||||
|
||||
**Cons:** Expensive for 4 or more hosts. No patch rollback.
|
||||
如果你想在安装后设置实时补丁服务,依照以下方法逐步执行:
|
||||
|
||||
**Enable Canonical Livepatch Service**
|
||||
|
||||
If you want to setup Livepatch service after installation, just do the following steps.
|
||||
|
||||
Get a key at [**https://auth.livepatch.canonical.com/**][8].
|
||||
从 [**https://auth.livepatch.canonical.com/**][8] 获取一个秘钥.
|
||||
|
||||
```
|
||||
$ sudo snap install canonical-livepatch
|
||||
@ -159,29 +155,29 @@ $ sudo snap install canonical-livepatch
|
||||
$ sudo canonical-livepatch enable your-key
|
||||
```
|
||||
|
||||
#### Method 7 – Update the Linux Kernel with KernelCare
|
||||
#### 方法7- 使用KernelCare升级Linux内核
|
||||
|
||||
![][9]
|
||||
|
||||
[**KernelCare**][10] is the newest of all the live patching solutions. It is the product of [CloudLinux][11]. KernelCare runs on Ubuntu and other flavors of Linux. It checks for patch releases every 4 hours and will install them without confirmation. Patches can be rolled back if there are problems.
|
||||
[**KernelCare**][10] 是所有实时补丁方案中最新的一个. 它是 [CloudLinux][11]推出的产品. KernelCare 可以运行在Ubuntu和其他的Linux特殊发行版中. 它每四个小时检查一遍补丁的发布,并在无需确认的情况下安装它们. 如果更新后存在问题,可以将补丁进行回滚。
|
||||
|
||||
**Cost**
|
||||
**价格**
|
||||
|
||||
Fees, per server: **4 USD per month** , **45 USD per year**.
|
||||
费用,每台服务器:**4 美元/月** , **45 美元/年**.
|
||||
|
||||
Compared to Ubuntu Livepatch, kernelCare seems very cheap and affordable. Good thing is **monthly subscriptions are also available**. Another notable feature is it supports other Linux distributions, such as Red Hat, CentOS, Debian, Oracle Linux, Amazon Linux and virtualization platforms like OpenVZ, Proxmox etc.
|
||||
跟Ubuntu Livepatch相比,kernelCare看起来非常便宜、实惠。好的方面在于**也可以按月订阅**。另一个前者不具备的功能是支持如Red Hat, CentOS, Debian, Oracle Linux, Amazon Linux 以及 OpenVZ, Proxmox 这种虚拟平台等等的其他Linux发行版。
|
||||
|
||||
You can read all the features and benefits of KernelCare [**here**][12] and check all available plan details [**here**][13].
|
||||
你可以在 [**此处**][12] 了解KernelCare的所有特性和简介,以及所有的付费计划的细节。
|
||||
|
||||
**Pros:** Simple. Fully automated. Wide OS coverage. Patch rollback. No reboot necessary. Free license for non-profit organizations. Low cost.
|
||||
**优势:** 简单。全自动化。范围更广的操作系统覆盖。补丁回滚。无需重启。对非盈利组织提供免费许可。价格低廉。
|
||||
|
||||
**Cons:** Not free (except for 30 day trial).
|
||||
**缺点:** 除了30天试用外无免费计划。
|
||||
|
||||
**Enable KernelCare Service**
|
||||
**开启 KernelCare Service**
|
||||
|
||||
Get a 30-day trial key at [**https://cloudlinux.com/kernelcare-free-trial5**][14].
|
||||
此处 [**https://cloudlinux.com/kernelcare-free-trial5**][14] 获取30天免费试用秘钥。
|
||||
|
||||
Run the following commands to enable KernelCare and register the key.
|
||||
执行以下命令开启KernelCare并注册秘钥。
|
||||
|
||||
```
|
||||
$ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash
|
||||
@ -189,15 +185,16 @@ $ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.s
|
||||
$ sudo /usr/bin/kcarectl --register KEY
|
||||
```
|
||||
|
||||
If you’re looking for an affordable and reliable commercial service to keep the Linux Kernel updated on your Linux servers, KernelCare is good to go.
|
||||
如果你的目标是价格实惠,并且通过可靠的社区服务来保障你的Linux服务器核心的更新,那KernelCare是个不错的选择。
|
||||
|
||||
*with inputs from **Paul A. Jacobs** , a Technical Evangelist and Content Writer from Cloud Linux.*
|
||||
|
||||
**Suggested read:**
|
||||
*由来自Cloud Linux的技术撰稿人和内容作者**Paul A. Jacobs**撰写。*
|
||||
|
||||
And, that’s all for now. Hope this was useful. If you believe any other tools/methods should include in this list, feel free to let us know in the comment section below. I will check and update this guide accordingly.
|
||||
**推荐阅读:**
|
||||
|
||||
More good stuffs to come. Stay tuned!
|
||||
到此,希望这边文章能对你有所帮助。如果你觉得还有其他的工具和方法需要列在这里,可以在留言区给我们留言。我会根据反馈检查和更新这篇指南的。
|
||||
|
||||
接下来会有更多好东西给大家呈现,敬请期待。
|
||||
|
||||
Cheers!
|
||||
|
||||
@ -209,7 +206,7 @@ via: https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[mr-ping](https://github.com/mr-ping)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
Loading…
Reference in New Issue
Block a user