设为首页 收藏本站
查看: 583|回复: 0

[经验分享] 升级CentOS 5.5

[复制链接]

尚未签到

发表于 2016-5-13 09:57:15 | 显示全部楼层 |阅读模式
  要测试一些软件,需要2.6.30以上的内核,安装好CentOS 5.5,内核是2.6.18-194.el5.这次的升级还算比较顺利,具体的过程如下:
[iyunv@localhost ~]# uname -r
2.6.18-194.el5
1.下载linux-2.6.30内核包到/usr/src目录
cd /usr/src
wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.gz 

tar -xzvf linux-2.6.30.tar.bz2 -C /usr/src
cd linux-2.6.30
make mrproper  清除环境变量,即清除配置文件
make menuconfig 在菜单模式下选择需要编译的内核模块:

networking support—>networking options—>network packet filtering framework(netfilter)

(1).core netfilter configuration
A 勾中”Netfilter connection tracking support”  -m state相关模块是依赖它的,不选则没有。
B 将netbios name service protocal support(new)   编译成模块,不然后面升级iptables后启动时会出错
C 勾中“Netfilter Xtables support (required for ip_tables)”
(2).IP: Netfilter Configuration
A 将 “IPv4 connection tracking support (require for NAT)” 编译成模块。
B 勾中IP tables support (required for filtering/masq/NAT) 。
C 将 “Full NAT” 下的 “MASQUERADE target support” 和 “REDIRECT target support” 编译成模块
(3).其它模块可以根据自己的需要进行选择,若不懂可以参考内核配置手册.

make clean  确保所有东西均保持最新状态.
make bzImage  生成内核文件
make modules 编译模块
make modules_install 安装模块
make install  安装
mkinitrd  /boot/initrd_2.6.30.img  2.6.30  根据内核版本和指定参数生成映像文件
cp arch/x86/boot/bzImage /boot/vmlinuz-2.6.30
cp /usr/src/linux-2.6.30/System.map /boot/System.map-2.6.30

2.在/etc/grub.conf添加如下2.6.30的信息,并把default=1改为default=0
[iyunv@localhost ~]# 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/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-194.el5.img

title CentOS (2.6.30)
        root (hd0,0)
        kernel /vmlinuz-2.6.30 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.30.img

3.此步若没有操作,重启会报错”insmod: error inserting ‘/lib/dm-region-hash.ko’: –1 File exits”,原因是重复了,根据网上查到的资料,2.6.x自编译内核会有这个小bug,我测试过不修改直接重启,虽然有报错,但仍然可以进入系统的.



[iyunv@localhost]cp /boot/initrd-2.6.30.img /tmp
[iyunv@localhost]cd /tmp/
[iyunv@localhost tmp]mkdir newinitrd
[iyunv@localhost tmp]cd newinitrd/
[iyunv@localhost newinitrd]zcat ../initrd-2.6.30.img |cpio -i
[iyunv@localhost newinitrd]vi init             删掉重复的如下两行:
echo “Loading dm-region-hash.ko module”
insmod /lib/dm-region-hash.ko

[iyunv@localhost newinitrd]# find .|cpio -c -o > ../initrd
14765 blocks
[iyunv@localhost newinitrd]# cd ..
[iyunv@localhost tmp]# gzip -9 < initrd > initrd-2.6.30.img
[iyunv@localhost tmp]# ls
gconfd-root  initrd  initrd-2.6.30.img  mapping-root  newinitrd  scim-panel-socket:0-root
[iyunv@localhost tmp]# mv /boot/initrd-2.6.30.img /home/
[iyunv@localhost tmp]# cp initrd-2.6.30.img /boot/
[iyunv@localhost tmp]#reboot

4.重启成功后,再看看内核,是2.6.30,ok了。
[iyunv@localhost ~]# uname -r
2.6.30

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-216376-1-1.html 上篇帖子: CentOS 5.5 下手工建立系统菜单中应用程序的“快捷方式” 下篇帖子: CentOS中文语言包输入法安装 (2011-08-14 11:24)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表