mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-13 22:30:37 +08:00
Merge pull request #2649 from ictlyh/master
[Translating] tech/How to Install Linux Kernel 4.0 from Elrepo / Source ...
This commit is contained in:
commit
140adb59a6
@ -1,147 +0,0 @@
|
||||
How to Install Linux Kernel 4.0 from Elrepo / Source on Ubuntu / CentOs
|
||||
================================================================================
|
||||
Hi everyone, today we'll learn how to install the latest Linux Kernel 4.0 from Elrepo and compiling using Source. Linux Kernel 4.0 is the latest Mainline Kernel codenamed ‘Hurr durr I’m a sheep’ till date. It is the kernel released after the stable released of 3.19.4 . April 12 is considered as a big day for all fans of the Open Source movement, as Linus Torvalds announced the release of Linux Kernel 4.0 and its immediate availability. It is considered as a big release as it consists of some awesome features which includes no-reboot patching (Live Patching), New and Updated Drivers, New and Latest Hardware Support and more interesting features with a new version change. But Kernel 4.0 is not considered as a huge release as expected but Linus announced that 4.1 is expected for a bigger release. The Live Patching feature was already integrated with the SUSE Enterprise Linux operating system. Here is the [release announcement][1] you can check for more details about the release.
|
||||
|
||||
> **WARNING**: Installing a new kernel may render your system unusable or unstable. If you proceed with the installation using the instructions below, make sure you back up any important data you have to an external hard drive.
|
||||
|
||||
### Installing Linux Kernel 4.0 on Ubuntu 15.04 ###
|
||||
|
||||
If you are running an Ubuntu 15.04 Distribution of Linux. You can simply install it straight from Ubuntu Kernel site. To install the latest Linux Kernel 4.0 in your Ubuntu 15.04, you'll need to run the following commands under root access in a shell or a terminal.
|
||||
|
||||
#### On a 64-bit Ubuntu 15.04 ####
|
||||
|
||||
$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-headers-4.0.0-040000-generic_4.0.0-040000.201504121935_amd64.deb
|
||||
|
||||
$ sudo dpkg -i linux-headers-4.0.0*.deb linux-image-4.0.0*.deb
|
||||
|
||||
#### On a 32-bit Ubuntu 15.04 ####
|
||||
|
||||
$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-headers-4.0.0-040000-generic_4.0.0-040000.201504121935_i386.deb
|
||||
|
||||
$ sudo dpkg -i linux-headers-4.0.0*.deb linux-image-4.0.0*.deb
|
||||
|
||||
### Installing Linux Kernel 4.0 on CentOS 7 ###
|
||||
|
||||
We can easily install Linux Kernel 4.0 using two ways in CentOS 7 .
|
||||
|
||||
1. Installing from Elrepo Repository
|
||||
1. Compiling and installing from the Source Code
|
||||
|
||||
First we'll gonna go for installing using ELRepo as its the easiest way to do.
|
||||
|
||||
#### Installing using Elrepo ####
|
||||
|
||||
**1. Downloading and Installing ELRepo**
|
||||
|
||||
We'll first gonna download the GPG key of ELRepo and install the relrepo-release package. As we're running CentOS 7, we'll gonna install elrepo-release-7.0-2.el7.elrepo.noarch.rpm using the command below.
|
||||
|
||||
Note: If you have a secure boot enabled please see [this page for more information][2].
|
||||
|
||||
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
|
||||
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
|
||||
|
||||
![Adding Elrepo Source](http://blog.linoxide.com/wp-content/uploads/2015/04/adding-elrepo.png)
|
||||
|
||||
**2. Updating Linux Kernel to version 4.0**
|
||||
|
||||
Now, we'll gonna install the latest stable kernel 4.0 from the ELRepo repository. To do so, we'll need to enter the following commands in a shell or terminal of the CentOS 7.
|
||||
|
||||
# yum --enablerepo=elrepo-kernel install kernel-ml
|
||||
|
||||
![Installing Linux Kernel 4.0 from ELRepo](http://blog.linoxide.com/wp-content/uploads/2015/04/installing-kernel-4-0-elrepo.png)
|
||||
|
||||
The above command will automatically install the Linux Kernel 4.0 build for CentOS 7.
|
||||
|
||||
Now, here below is the another way of installing the latest kernel 4.0 by compiling from the source.
|
||||
|
||||
#### Compiling and Installing from the Source ####
|
||||
|
||||
**1. Installing the Dependencies**
|
||||
|
||||
So, first of all we'll need to install the dependencies required to compile the linux kernel. To do so, we'll need to run the following command in a terminal or a shell.
|
||||
|
||||
# yum groupinstall "Development Tools"
|
||||
|
||||
# yum install gcc ncurses ncurses-devel
|
||||
|
||||
![Installing Kernel Dependencies](http://blog.linoxide.com/wp-content/uploads/2015/04/installing-dependencies.png)
|
||||
|
||||
Then, we'll gonna update our whole system.
|
||||
|
||||
# yum update
|
||||
|
||||
**2. Downloading the source**
|
||||
|
||||
We'll now download the latest release linux kernel 4.0 source using wget command from the official repository of Linux Kernel. You can also download the kernel directly from the site [kernel.org][3] using your web browser also.
|
||||
|
||||
# cd /tmp/
|
||||
# wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.0.tar.xz
|
||||
|
||||
![Download Kernel Source](http://blog.linoxide.com/wp-content/uploads/2015/04/download-kernel-source.png)
|
||||
|
||||
**3. Extracting the tarball**
|
||||
|
||||
Once the file is downloaded we'll extract it under /usr/src/ directory by running the below command.
|
||||
|
||||
# tar -xf linux-4.0.tar.xz -C /usr/src/
|
||||
# cd /usr/src/linux-4.0/
|
||||
|
||||
![Extracting Kernel Tarball](http://blog.linoxide.com/wp-content/uploads/2015/04/extracting-kernel-tarball.png)
|
||||
|
||||
**4. Configuring**
|
||||
|
||||
We have two options to configure the Linux Kernel. We can either create a new custom configuration or use the old configuration to build and install the Linux Kernel. It all depends on what you really want.
|
||||
|
||||
**For New Kernel Configuration**
|
||||
|
||||
Now we'll run the make menuconfig command in the shell or terminal to configure the Linux kernel. Once we've executed the below command a pop up window with all the menus appears. Here we can select our new kernel configuration. If you unfamiliar with these menus, just hit double ESC key to exit.
|
||||
|
||||
# make menuconfig
|
||||
|
||||
![Configuring New Kernel Config](http://blog.linoxide.com/wp-content/uploads/2015/04/configuring-new-kernel-config.png)
|
||||
|
||||
**For Old Configuration**
|
||||
|
||||
If you like to configure your latest kernel with your old configuration then simple type the below command. If you were asked any stuff, you can choose with Y or N or you can simply press Enter to continue.
|
||||
|
||||
# make oldconfig
|
||||
|
||||
#### Step 5. Compiling the Linux Kernel ####
|
||||
|
||||
Next, we'll execute the make command to compile the Kernel 4.0 . The compilation would take at least 20-30 minutes depends on your system configuration.
|
||||
|
||||
Note: If you got an error while compiling the kernel saying bc command not found. You can fix that by installing bc using the command **yum install bc** .
|
||||
|
||||
# make
|
||||
![Make Kernel](http://blog.linoxide.com/wp-content/uploads/2015/04/make-kernel.png)
|
||||
|
||||
#### 6. Installing Linux Kernel 4.0 ####
|
||||
|
||||
Once the compilation is completed, we'll now finally install the **Kernel** in our Linux System. The below command will create files under /boot directory and also makes a new kernel entry in the Grub Menu.
|
||||
|
||||
# make modules_install install
|
||||
|
||||
#### 7. Verifying Kernel ####
|
||||
|
||||
After installing our latest kernel 4.0 we'll want to verify it. To do so we'll just type the following command on the terminal. If everything went fine, we'll get the kernel version ie. 4.0 enlisted in the output below.
|
||||
|
||||
# uname -r
|
||||
|
||||
#### Conclusion ####
|
||||
|
||||
Hurray, we have successfully installed the latest version of linux kernel ie 4.0 in our CentOS 7 Operating System. Upgrading a linux kernel is always not necessary cause the hardware you got working with the previous version of it may not get working with the newer version. We should make sure that the it includes the features and stuffs that are necessary to make your hardware working. But mostly, the newer stable versions of kernel makes your hardware performance better. So, if you have any questions, comments, feedback please do write on the comment box below and let us know what stuffs needs to be added or improved. Thank You! Enjoy the latest stable version of Linux Kernel 4.0 :-)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/how-tos/install-linux-kernel-4-0-elrepo-source/
|
||||
|
||||
作者:[Arun Pyasi][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arunp/
|
||||
[1]:http://lkml.iu.edu/hypermail/linux/kernel/1504.1/03198.html
|
||||
[2]:http://elrepo.org/tiki/SecureBootKey
|
||||
[3]:http://kernel.org/
|
@ -0,0 +1,146 @@
|
||||
如何从Elrepo/源 在Ubuntu/CentOS上安装Linux内核4.0
|
||||
================================================================================
|
||||
大家好,今天我们学习一下如何从Elrepo或者编译源码安装最新的Linux内核4.0。昵称为‘Hurr durr I’m a sheep’的Linux内核4.0是目前为止最新的主干内核。是稳定版3.19.4后发布的内核。Linux Torvalds声明了Linux内核4.0的发布以及可及时提供,4月12日被认为是所有开源运动爱好者的重大日子。由于包括了一些很棒的功能,例如无重启补丁(实时补丁),新的升级驱动,最新的硬件支持以及很多有趣的功能都有新的版本,它被认为是一次重大发布。但是内核4.0并不认为是期望中的重大发布,Linus表示期望4.1是一个更大的发布。实时补丁功能已经集成到了SUSE企业版Linux操作系统上。你可以在[发布公告][1]上查看关于这次发布的更多详细内容。
|
||||
|
||||
> **警告**: 安装新的内核可能会导致你的系统不可用或不稳定。如果你仍然使用以下命令继续安装,请确保备份所有重要数据到外部硬盘。
|
||||
|
||||
### 在Ubuntu 15.04上安装Linux内核4.0 ###
|
||||
|
||||
如果你正在使用Linux的发行版Ubuntu 15.04,你可以直接通过Ubuntu内核网站安装。在你的Ubuntu15.04上安装最新的Linux内核4.0,你需要在shell或终端中在root访问权限下运行一下命令。
|
||||
|
||||
#### 在 64-bit Ubuntu 15.04 ####
|
||||
|
||||
$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-headers-4.0.0-040000-generic_4.0.0-040000.201504121935_amd64.deb
|
||||
|
||||
$ sudo dpkg -i linux-headers-4.0.0*.deb linux-image-4.0.0*.deb
|
||||
|
||||
#### 在 32-bit Ubuntu 15.04 ####
|
||||
|
||||
$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-headers-4.0.0-040000-generic_4.0.0-040000.201504121935_i386.deb
|
||||
|
||||
$ sudo dpkg -i linux-headers-4.0.0*.deb linux-image-4.0.0*.deb
|
||||
|
||||
### 在CentOS 7上安装Linux内核4.0 ###
|
||||
|
||||
我们可以用两种简单的方式在CentOS 7上安装Linux内核4.0。
|
||||
|
||||
1. 从Elrepo软件仓库安装
|
||||
1. 从源代码编译安装
|
||||
|
||||
由于是最简单的方式,我们首先用ElRepo安装。
|
||||
|
||||
#### 使用 Elrepo 安装 ####
|
||||
|
||||
**1. 下载和安装ELRepo**
|
||||
|
||||
我们首先下载ELRepo的GPG密钥并安装relrepo-release安装包。因为我们用的是CentOS 7,我们使用以下命令安装elrepo-release-7.0-2.el7.elrepo.noarch.rpm。
|
||||
|
||||
注: 如果你启用了secure boot,请查看[这个网页获取更多信息][2]。
|
||||
|
||||
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
|
||||
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
|
||||
|
||||
![添加 Elrepo 源](http://blog.linoxide.com/wp-content/uploads/2015/04/adding-elrepo.png)
|
||||
|
||||
**2. 升级Linux内核到4.0版本**
|
||||
|
||||
现在,我们打算从ELRepo软件仓库安装最新的稳定版内核4.0。做这些,我们需要在CentOS 7的shell或者终端中输入以下命令。
|
||||
|
||||
# yum --enablerepo=elrepo-kernel install kernel-ml
|
||||
|
||||
![从ELRepo安装Linux内核4.0](http://blog.linoxide.com/wp-content/uploads/2015/04/installing-kernel-4-0-elrepo.png)
|
||||
|
||||
上面的命令会自动安装为CentOS 7构建的Linux内核4.0。
|
||||
|
||||
现在,下面的是另一种方式,通过编译源代码安装最新的内核4.0。
|
||||
|
||||
#### 从源代码编译安装 ####
|
||||
|
||||
**1. 安装依赖软件**
|
||||
|
||||
首先我们需要为编译linux内核安装依赖的软件。做这些,我们需要在一个终端或者shell中运行以下命令。
|
||||
|
||||
# yum groupinstall "Development Tools"
|
||||
|
||||
# yum install gcc ncurses ncurses-devel
|
||||
|
||||
![安装内核依赖](http://blog.linoxide.com/wp-content/uploads/2015/04/installing-dependencies.png)
|
||||
|
||||
然后,我们会升级我们的整个系统。
|
||||
|
||||
# yum update
|
||||
|
||||
**2. 下载源代码**
|
||||
|
||||
现在我们通过wget命令从Linux内核官方仓库中下载最新发布的linux内核4.0的源代码。你也可以使用你的浏览器直接从[kernel.org][3]网站下载内核。
|
||||
|
||||
# cd /tmp/
|
||||
# wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.0.tar.xz
|
||||
|
||||
![下载内核源码](http://blog.linoxide.com/wp-content/uploads/2015/04/download-kernel-source.png)
|
||||
|
||||
**3. 解压tar压缩包**
|
||||
|
||||
文件下载好后我们在/usr/src/文件夹下用以下命令解压。
|
||||
|
||||
# tar -xf linux-4.0.tar.xz -C /usr/src/
|
||||
# cd /usr/src/linux-4.0/
|
||||
|
||||
![解压内核tar压缩包](http://blog.linoxide.com/wp-content/uploads/2015/04/extracting-kernel-tarball.png)
|
||||
|
||||
**4. 配置**
|
||||
|
||||
我们要配置Linux内核的两个选项。我们可以创建一个新的自定义配置文件或者使用旧的配置文件来构建和安装Linux内核。这都取决于你自己的想法。
|
||||
|
||||
**配置新的内核**
|
||||
|
||||
现在我们在shell或终端中运行make menuconfig命令来配置Linux内核。我们执行以下命令后会显示一个包含所有菜单的弹出窗口。在这里我们可以选择我们新的内核配置。如果你不熟悉这些菜单,那就敲击ESC键两次退出。
|
||||
|
||||
# make menuconfig
|
||||
|
||||
![配置新内核](http://blog.linoxide.com/wp-content/uploads/2015/04/configuring-new-kernel-config.png)
|
||||
|
||||
**旧的配置**
|
||||
|
||||
如果你想用旧的配置文件配置你最新的内核,那就输入下面的命令。如果对你有任何提问,你可以选择Y或者N,或者仅仅是按Enter键继续。
|
||||
# make oldconfig
|
||||
|
||||
#### Step 5. 编译Linux内核 ####
|
||||
|
||||
下一步,我们会执行make命令来编译内核4.0。取决于你的系统配置,编译至少需要20-30分钟。
|
||||
|
||||
注:如果编译内核的时候出现bc command not found的错误,你可以用**yum install bc**命令安装bc修复这个错误。
|
||||
|
||||
# make
|
||||
![Make 内核](http://blog.linoxide.com/wp-content/uploads/2015/04/make-kernel.png)
|
||||
|
||||
#### 6. 安装Linux内核4.0 ####
|
||||
|
||||
编译完成后,我们终于要在你的Linux系统上安装**内核**了。下面的命令会在/boot目录下创建文件并且在Grub Menu中新建一个内核条目。
|
||||
|
||||
# make modules_install install
|
||||
|
||||
#### 7. 验证内核 ####
|
||||
|
||||
安装完最新的内核4.0后我们希望能验证它。做这些我们只需要在终端中输入以下命令。如果所有都进展顺利,我们会看到内核版本,例如4.0出现在输出列表中。
|
||||
|
||||
# uname -r
|
||||
|
||||
#### 结论 ####
|
||||
|
||||
好了,我们成功地在我们的CentOS 7操作系统上安装了最新的Linux内核版本4.0。通常并不需要升级linux内核,因为和之前版本运行良好的硬件可能并不适合新的版本。我们要确保它包括能使你的硬件正常工作的功能和配件。但大部分情况下,新的稳定版本内核能使你的硬件性能更好。因此,如果你有任何问题,评论,反馈,请在下面的评论框中注明,让我们知道需要增加或者删除什么问题。多谢!享受最新的稳定版Linux内核4.0吧 :-)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/how-tos/install-linux-kernel-4-0-elrepo-source/
|
||||
|
||||
作者:[Arun Pyasi][a]
|
||||
译者:[ictlyh](https://github.com/ictlyh)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arunp/
|
||||
[1]:http://lkml.iu.edu/hypermail/linux/kernel/1504.1/03198.html
|
||||
[2]:http://elrepo.org/tiki/SecureBootKey
|
||||
[3]:http://kernel.org/
|
Loading…
Reference in New Issue
Block a user