Linux升级内核

1. 查看linux内核版本:
# uname -r
2.6.18-194.el5

2. 下载新的内核版本:
去官网上下载最新的内核版本和对应的补丁:
https://www.kernel.org/
我选的是3.2.14
#wget -c http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.14.tar.bz2

3. 解压
将所需文件复制到 /usr/src 下并解压。
(注:如果/usr/src下的空间不够,将源文件放在别的目录下也是一样的)
# cp linux-3.2.14.tar.gz /usr/src/
# cd /usr/src/

将文件解压到 /usr/src/kernels
# tar -xvf linux-3.2.14.tar.gz -C /usr/src/kernels

4. 清理文件
清除掉以前升级留下的一些不正确文件。
# cd /usr/src/kernels/linux-3.2.14
# yum install ncurses-devel       #升级ncurses
# make mrporper
# cp /boot/config-‘uname -r’ /usr/src/kernels/linux3.2.14/.config  #使用原来的配置文件

5. 通过菜单方式配置内核
# cd /usr/src/kernels/linux-3.2.14
# make menuconfig
linux配置菜单如下图所示:


一定要勾选(输入y选中,M编译为模块)
a、General setup→[*] enable deprecated sysfs features to support old userspace tools
b、Processor type and features→HighMemory Support。
c、找到以下选中选项并选中:
networking support → networking options → network packet filtering framework(netfilter)
(1)Corenetfilter 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" 编译成模块

6. 编译并安装内核
# make clean          // 清除下内核编译的目标文件
# make bzImage    // 生成内核文件
# make modules    // 编码模块
# make modules_install // 安装模块
# make install         // 安装

7. 编辑开机菜单选项grub文件
将 default=1 改为 default=0
# vim /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 do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (3.2.14)
        root (hd0,0)
        kernel /boot/vmlinuz-3.2.14 ro root=LABEL=/
        initrd /boot/initrd-3.2.14.img
title Red Hat Enterprise Linux Server (2.6.18-274.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-274.el5 ro root=LABEL=/
        initrd /boot/initrd-2.6.18-274.el5.img
【保存并退出】

8. 重启
# shutdown -r "now"

9. 查看内核编译结果
# uname -r
3.2.14-rt24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值