【实用方法】CentOS Linux 升级内核

尊重原创,转自:http://down.chinaz.com/server/201202/1598_1.htm,根绝个人需求进行适当改变。

本次主要是将linux内核从2.6.39升级到3.2.2。

1、查看当前系统内核

# uname -r
2 2.6.32-71.el6.i686

2、下载linux-3.2.2内核包

# cd ~
# wget -c http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.2.tar.bz2
# tar jxvf linux-3.2.2.tar.bz2
# cd linux-3.2.2

3、配置内核并安装

# make mrproper    #清除环境变量,即清除配置文件
# make menuconfig  #在菜单模式下选择需要编译的内核模块

找到以下选中选项并选中networking support → networking options → network packet filtering framework(netfilter)

(1)Core netfilter configuration

  • 勾中"Netfilter connection tracking support" -m state相关模块是依赖它的,不选则没有。
  • 将netbios name service protocal support(new) 编译成模块,不然后面升级iptables后启动时会出错
  • 勾中"Netfilter Xtables support (required for ip_tables)"

(2)IP: Netfilter Configuration

  • 将 "IPv4 connection tracking support (require for NAT)" 编译成模块。
  • 勾中IP tables support (required for filtering/masq/NAT) 。
  • 将 "Full NAT" 下的 "MASQUERADE target support" 和 "REDIRECT target support" 编译成模块

(3)其它模块可以根据自己的需要进行选择,若不懂可以参考内核配置手册.

# make clean #确保所有东西均保持最新状态.
# make bzImage #生成内核文件
# make modules #编译模块
# make modules_install #安装模块
# make install #安装

4、编辑 /etc/grub.conf 文件,将 default=1 改为 default=0

# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS Linux (3.2.2)
root (hd0,0)
kernel /vmlinuz-3.2.2 ro root=/dev/mapper/VolGroup-lv_root rd_LVM_LV=VolGroup/lv_root rd_LVM_LV=VolGroup/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
initrd /initramfs-3.2.2.img
title centos (2.6.32-71.el6.i686)
root (hd0,0)
kernel /vmlinuz-2.6.32-71.el6.i686 ro root=/dev/mapper/VolGroup-lv_root rd_LVM_LV=VolGroup/lv_root rd_LVM_LV=VolGroup/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
initrd /initramfs-2.6.32-71.el6.i686.img

5、重启系统,并查看内核

# reboot
# uname -r
3.2.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值