请保证/root可用空间在10G以上。


1)获取kernel.src.rpm


lftp ftp.redhat.com:/pub/redhat/linux/enterprise/6Server/en/os/SRPMS


get kernel-2.6.32-504.3.3.el6.src.rpm   


2)安装依赖包

yum install elfutils-devel elfutils-libelf-devel asciidoc xmlto redhat-rpm-config patchutils binutils-devel \

newt-devel audit-libs-devel bison flex hmaccalc perl perl-devel perl-ExtUtils-Embed rpm-build -y


3)编译kernel

groupadd mockbuild

useradd -g mockbuild mockbuild

rpm -ivh kernel-2.6.32-504.3.3.el6.src.rpm


编辑/root/rpmbuild/SOURCES/config-generic

修改 CONFIG_IP_VS_TAB_BITS=12 (2的12次方,4096)为 CONFIG_IP_VS_TAB_BITS=20 


cd /root/rpmbuild/SPECS/

rpmbuild -bb --target=`uname -m` kernel.spec



出现:

-------------------------------

+ gpg --homedir . --batch --gen-key /root/rpmbuild/SOURCES/genkey

gpg: WARNING: unsafe permissions on homedir `.'

gpg: keyring `./secring.gpg' created

gpg: keyring `./pubring.gpg' created

gpg: WARNING: some OpenPGP programs can't handle a DSA key with this digest size

或出现:

gpg: WARNING: unsafe permissions on homedir `.'


经过漫长的等待...


rpm -Uvh 吧

reboot 后,再 ipvsadm -ln 就可以看到效果了!

# ipvsadm -Ln
IP Virtual Server version 1.2.1 (size=1048576)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn


linux_redhat源码的路径:

http://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/


参考:

http://www.360doc.com/content/14/0726/00/11962419_397102114.shtml

http://www.linuxidc.com/Linux/2012-07/64265.htm