CentOS 7 under the new version of the kernel source code compiler installation

The latest version of the Linux kernel can https://www.kernel.org/ access to the Web

1. Download the latest stable version of the kernel source package to / usr / local / src, and unzip into the current directory

2, extract the kernel source

3, from the / boot directory will compile the existing version of the kernel config configuration file to copy over into the new kernel source directory and rename it to extract the inner .config hidden files

[root@localhost src]# cd linux-5.2.11

[root@localhost linux-5.2.11]# cp /boot/config-3.10.0-957.el7.x86_64 ./.config

Come from the config file copy of the original kernel boot directory is to facilitate, this configuration file is saved in the kernel module mounting system installed information (otherwise need to manually specify compile each module configuration).

4, the installation dependencies

Install the Developer Tools Group

[root@localhost linux-5.2.11]# yum -y groupinstall "development tools"

Installation ncurse-devel package (make menuconfig text interface window dependencies)

[root@localhost linux-5.2.11]# yum -y install ncurses-devel

5, run make menuconfig, open the Options menu window compiled text interface, can be adjusted to load the kernel module compilation options, such as changing the name to compile the kernel, before a new system is added the missing modules.

Modify the kernel name:

General setup --->local version -append to kernel release

Here modify the kernel name 5.2.11-001.el7.x86_64

Newly added support NTFS file system module:

File systems --->DOS/FAT/NT Filesystems --->NTFS file system support

It recommended to choose (M option) compiled in a modular manner. (* Number is based on statically compiled into the kernel package file, if the new module is added more, resulting in a kernel file size increases)

6, compile the kernel

[Root @ localhost linux-5.2.11] # make -j 4 # CPU core based on the number of open multi-threaded compiler to speed up the compilation speed

It began the long process of compilation, probably need about 1-2 hours, depending on the performance of the CPU hardware decisions.

If the compiler starts an error, it may be pre-installed components corresponding package, for example:

[root@localhost linux-5.2.11]# yum -y install openssh-devel elfutils-libelf-devel bc

The corresponding error message, yum mounted components corresponding to packet, the packet assembly epel source portion, it is necessary to pre-configured epel source repository.

7, compile and install the module

After compilation execution make modules_install to install the kernel module

[root@localhost linux-5.2.11]# make modules_install

8, install the kernel core files

[root@localhost linux-5.2.11]# make install

reboot reboot

For the new version of the kernel as the default boot kernel, you can use this command

grub2-set-default 0 # 0 represents /boot/grub2/grub.cfg file in the first row of section menuentry

After rebooting into the system, check the kernel version, it is already the newest version 5.2.11

[root@localhost ~]# uname -r

5.2.11-001.el7.x86_64

At this point, compiling the whole kernel of the installation process is complete.

Guess you like

Origin www.linuxidc.com/Linux/2019-11/161257.htm