Linux内核的升级


1:准 备工作 linux系统需要安装开发工具和开发库
2:准备相应的内核文件盒补丁
3:将文件上传至windows的家目录

目标功能:
为iptables增加layer7补丁,实现应用层过滤。

一、重新编译内核

1、合并kernel+layer7补丁

shell> tar jxvf linux-2.6.25.19.tar.gz2 -C /usr/src/
shell> tar zxvf netfilter-layer7-v2.20.tar.gz -C /usr/src/
shell>ln –s linux-2.6.25.19 linux
shell>cd linux
shell&gt; patch -p1 < /usr/src/netfilter-layer7-v2.20/kernel-2.6.25-layer7-2.20.patch6

2、配置新内核
shell> cp /boot/config-2.6.18-128.el5 .config    //偷个懒,沿用旧的内核配置
shell&gt; make menuconfig
//配置内核时,在“Networking ---&gt; Networking Options ---&gt; Network Packet filtering framework (Netfilter) ”处主要注意两个地方:
    1) ---&gt; Code Netfilter Configuration
        //将“Netfilter connection tracking suport (NEW)”选择编译为模块(M),需选取此项才能看到layer7支持的配置。
        //将layer7、string、state、time、IPsec、iprange、connlimit……等编译成模块,根据需要看着办。
2) ---&gt; IP: Netfilter Configuration
        //将“IPv4 connection tracking support (require for NAT)”编译成模块。
        //将“Full NAT”下的“MASQUERADE target support”和“REDIRECT target support”编译成模块。

3、编译及安装模块、新内核
shell&gt; make && make modules_install && make install
//编译安装成后后,重启选择使用新的内核(2.6.25.19)引导系统
Vim /etc/grub.conf
#boot=/dev/sda
default=0 把1改为0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.25.19)
root (hd0,0)
kernel /vmlinuz-2.6.25.19 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.25.19.img
title Red Hat Enterprise Linux Server (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-164.el5.img

12,OK,大功告成!赶快重启,看看升级后的2.6内核吧~~~~

相关内容