This article applies to CentOS 6.5, CentOS 6.6, pro-test, and estimates for other Linux distributions.
1. Preparation work 1.1 Download the source package
There are two versions of the Linux kernel: stable and development, and the Linux kernel version number consists of 3 numbers: r.x.y
- R: Major Version number
- X: Minor version number, even for stable version, odd for developing version.
- Y: Revision number, indicating number of changes
Go to http://www.kernel.org home, you can see there are stable, longterm and other versions, longterm is more stable than stable version, the president time update, so I chose 3.10.28,
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.28.tar.xz
1.2 Decompression
tar -xf linux-3.10.28.tar.xz
1.3 Updating the current system
sudo yum updatesudo yum upgrade
1.4 Installing the packages required to compile the kernel
sudo yum groupinstall "Development Tools" # 一口气安装编译时所需的一切工具sudo yum install ncurses-devel #必须这样才能让 make *config 这个指令正确地执行。sudo yum install qt-devel #如果你没有 X 环境,这一条可以不用sudo yum install hmaccalc zlib-devel binutils-devel elfutils-libelf-devel #创建 CentOS-6 内核时需要它们
2 configuration File 2.1 View current system kernel
uname -r2.6.32-358.11.1.el6.x86_64
2.2 Copy the current system's configuration file to the current directory
cp /boot/config-2.6.32-358.11.1.el6.x86_64 .config
2.3 Use the old kernel configuration and automatically accept the default settings for each new option
sh -c ‘yes "" | make oldconfig‘
make oldconfig
Will read the file in the current directory .config
, the .config
file does not find the option to prompt the user to fill in, and then back up the .config
file as .config.old
, and generate a new .config
file, refer to http://stackoverflow.com/questions/ 4178526/what-does-make-oldconfig-do-exactly-linux-kernel-makefile
3 compiling
sudo make -j8 bzImage #生成内核文件sudo make -j8 modules #编译模块sudo make -j8 modules_install #编译安装模块
To compile strictly in this order, cannot be merged into one sentence sudo make -j8 bzImage modules modules_install
.
-j
The following number is the number of threads, used to speed up the compilation speed, the general experience is, how much g memory, just fill that number, for example, there is 8G of memory, then yes -j8
.
4 Installation
sudo make install
If there ERROR: modinfo: could not find module xxx
is a small amount, it can be ignored.
5 Modifying the Grub boot order
After the installation is complete, you need to modify the Grub boot order so that the newly installed kernel is the default kernel.
Edit grub.conf
the file,
sudo vim /etc/grub.conf
Count the newly installed kernel in which location, starting from 0, and then set the default to that number, generally the newly installed kernel is in the first position, so set default=0
.
6 restart
sudo reboot
After rebooting, look at the current kernel version number,
uname -r3.10.28
Success!!
7 If it fails, re-cycle
If it fails, start again and clean up the last compiled site.
Then go to the 2nd step and start over again.
CentOS 6.5 upgrade Kernel to 3.10.28