0, please use the physical machine installation, the virtual machine did not compile successfully 1, first check the system version, need to be CENTOS6, kernel 2.6
cat /etc/*release
uname -r
2. Download kernel rpm from Redhat website
wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/kernel-2.6.32-220.23.1.el6.src.rpm
If this is not possible, please download it from the network disk. Connection:
3. Get Kerel source code from rpm
vim ~/.rpmmacros; Add:%_topdir/home/pukong/rpms%_tmppath/home/pukong/rpms/tmp%_sourcedir/home/pukong/rpms/sources%_sp Ecdir/home/pukong/rpms/specs%_srcrpmdir/home/pukong/rpms/srpms%_rpmdir/home/pukong/rpms/rpms%_builddir/ Home/pukong/rpms/build Cd/home/pukong; mkdir RPMs; mkdir rpms/tmp; mkdir rpms/sources; mkdir rpms/specs; mkdir Rpms/srpms; mkdir Rpms/rpms; mkdir rpms/build;useradd MOCKBUILDRPM-IVH kernel-2.6.32-220.23.1.el6.src.rpmcd/home/pukong/rpms/specsyum-y Install Rpm-buildyum-y install gcc zlib-devel patchutils xmlto asciidoc elfutils-libelf-devel binutils-devel newt-devel python- Devel hmaccalcyum-y Install rng-tools openssl-develrngd-r/dev/urandom # #rng-tools used to perform RPMBUILD-BB--target= ' uname- M ' Kernel.spec when generated random number, otherwise it will be stuck there, but according to the place of the card back will see the prompt to execute rngd-r/dev/hwrandom, not the words to execute rngd-r/dev/urandom, So you need to install this tool rpmbuild-bp Kernel.spec;
The last Rpmbuild is one that may be a very lengthy operation, please do not close Xshell.
Then you can find the kernel source in/home/pukong/rpms/build.
[[email protected] SPECS]# cd /home/pukong/rpms/BUILD/;[[email protected] BUILD]# lskernel-2.6.32-220.23.1.el6
4. Add LVs Patch
[Lvs-fullnat-synproxy.tar.gz]
Https://pan.baidu.com/s/1sOnbGpnk7vZGoTxgEVDpAA
Place the file on the server
tar xvf Lvs-fullnat-synproxy.tar.gz cd lvs-fullnat-synproxy/cp lvs-2.6.32-220.23.1.el6.patch /home/pukong/rpms/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64/cd /home/pukong/rpms/BUILD/;cd kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64/;patch -p1<lvs-2.6.32-220.23.1.el6.patch; // patch is in lvs-fullnat-synproxy.tar.gz 给内核打补丁 补丁不能重复打
After patching, modify the makefile file to name the kernel version:
[[email protected] linux-2.6.32-220.23.1.el6.x86_64]# uname -r2.6.32-431.el6.x86_64[[email protected] linux-2.6.32-220.23.1.el6.x86_64]# vim Makefile
Add the Extraversion field in makefile to a field similar to uname-r, such as
VERSION = 2PATCHLEVEL = 6SUBLEVEL = 32EXTRAVERSION = -431.toa.el6.x86_64NAME = Man-Eating Seals of AntiquityRHEL_MAJOR = 6RHEL_MINOR = 2RHEL_RELEASE = 219
Note that modifying the parameters in the. config file is primarily to increase the VS maximum number of connections, which can increase the throughput of VS (concurrent connections) If the value is only 4096 of the original may drop packets
5. Compile the kernel
make -j16 ##j是指同时作业的数量,可以不用添加此参数make modules_install;make install;
There may be a few mistakes at this point.
[[email protected] linux-2.6.32-220.23.1.el6.x86_64]# make install;sh /home/pukong/rpms/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64/arch/x86/boot/install.sh 2.6.322.6.32-431.el6.x86_64 arch/x86/boot/bzImage
Need to copy in several modules
cp /lib/modules/2.6.32-431.el6.x86_64/kernel/drivers/mfd/lpc_ich.ko /lib/modules/2.6.32-431.toa.el6.x86_64/kernel/drivers/mfd/mkdir /lib/modules/2.6.32-431.toa.el6.x86_64/kernel/drivers/ptpcp /lib/modules/2.6.32-431.el6.x86_64/kernel/drivers/ptp/ptp.ko /lib/modules/2.6.32-431.toa.el6.x86_64/kernel/drivers/ptp/
Re-install, there will be a few warnings, ignore can
[[email protected] linux-2.6.32-220.23.1.el6.x86_64]# make install;sh /home/pukong/rpms/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64/arch/x86/boot/install.sh 2.6.32-431.toa.el6.x86_64 arch/x86/boot/bzImage
6. Modify Kernel Files
vim /boot/grub/grub.conf
Modifying the default value to 0 means start first
The boot file has two boot boot segments, one is the original kernel of Linux, one is the newly compiled kernel, the newly compiled kernel is above, so the default value of 0, that is, the use of the new kernel boot system.
7. Restart
reboot
LVS fullnat+ecmp "1" kernel compilation