[root@server01 ~]# uname -a
Linux server01 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@server01 ~]# uname -r
2.6.32-220.el6.x86_64
[root@server01 ~]# cd /boot
[root@server01 boot]# ll | grep -iE '*img| vmlinuz*'
-rw-r--r--. 1 root root 15998033 Mar 13 2013 initramfs-2.6.32-220.el6.x86_64.img
-rwxr-xr-x. 1 root root 3938800 Nov 9 2011 vmlinuz-2.6.32-220.el6.x86_64
[root@server01 boot]# more /boot/grub/menu.lst
# 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/vg_server01-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/mapper/vg_server01-lv_root rd_NO_LUKS rd_LVM_LV=vg_server01/lv_root LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=l
atarcyrheb-sun16 rhgb crashkernel=auto rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_server01/lv_swap
initrd /initramfs-2.6.32-220.el6.x86_64.img
[root@server01 yum.repos.d]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 6.2 (Santiago)
[root@server01 yum.repos.d]#
#######升级前是redhat 6.2版本#########################
[root@server01 yum.repos.d]# service vsftpd restart ######通过FTP复制和上传6.3的kernel RPM包
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@server01 yum.repos.d]# cd
[root@server01 ~]# ll
total 54532
-rw-------. 1 root root 2341 Mar 13 2013 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Mar 13 2013 Desktop
drwxr-xr-x. 2 root root 4096 Mar 13 2013 Documents
drwxr-xr-x. 2 root root 4096 Mar 13 2013 Downloads
-rw-r--r--. 1 root root 67015 Mar 13 2013 install.log
-rw-r--r--. 1 root root 15294 Mar 13 2013 install.log.syslog
-rw-r--r-- 1 root root 26408880 May 21 15:05 kernel-2.6.32-279.el6.x86_64.rpm
drwxr-xr-x. 2 root root 4096 Mar 13 2013 Music
drwxr-xr-x. 2 root root 4096 Mar 13 2013 Pictures
drwxr-xr-x. 2 root root 4096 Mar 13 2013 Public
drwxrwxr-x 8 oracle cimsrvr 4096 Mar 24 13:40 rlwrap-0.37
-rw-r--r-- 1 root root 251438 Mar 24 13:24 rlwrap-0.37.tar.gz
drwxr-xr-x 2 root root 4096 Jul 23 2013 scripts
drwxr-xr-x. 2 root root 4096 Mar 13 2013 Templates
drwxr-xr-x. 2 root root 4096 Mar 13 2013 Videos
[root@server01 ~]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Cleaning repos: rhel-source rhel-source-HA rhel-source-Server
Cleaning up Everything
[root@server01 ~]# rpm -ivh kernel-2.6.32-279.el6.x86_64.rpm
error: Failed dependencies:
kernel-firmware >= 2.6.32-279.el6 is needed by kernel-2.6.32-279.el6.x86_64
###firmware版本低,需要更新成6.3版本对应最新的firmware,跨越版本大一些依赖的软件包也需要更新最新版本
[root@server01 ~]# yum -y install kernel-firmware ######挂载6.3光盘,使用yum进行安装
[root@server01 ~]# rpm -ivh kernel-2.6.32-279.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:kernel ########################################### [100%]
[root@server01 ~]#
[root@server01 ~]#
[root@server01 ~]#
[root@server01 ~]# rpm -qa | grep kernel-2.6
kernel-2.6.32-279.el6.x86_64
kernel-2.6.32-220.el6.x86_64
[root@server01 ~]# cd /boot
[root@server01 boot]# ll | grep -iE '*img| vmlinuz*'
-rw-r--r--. 1 root root 15998033 Mar 13 2013 initramfs-2.6.32-220.el6.x86_64.img
-rw-r--r-- 1 root root 16231307 May 21 15:07 initramfs-2.6.32-279.el6.x86_64.img
-rwxr-xr-x. 1 root root 3938800 Nov 9 2011 vmlinuz-2.6.32-220.el6.x86_64
-rwxr-xr-x 1 root root 3986992 Jun 14 2012 vmlinuz-2.6.32-279.el6.x86_64
[root@server01 boot]# more /boot/grub/menu.lst
# 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/vg_server01-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.32-279.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/mapper/vg_server01-lv_root rd_NO_LUKS rd_LVM_LV=vg_server01/lv_root LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=l
atarcyrheb-sun16 rhgb crashkernel=auto rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_server01/lv_swap
initrd /initramfs-2.6.32-279.el6.x86_64.img
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/mapper/vg_server01-lv_root rd_NO_LUKS rd_LVM_LV=vg_server01/lv_root LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=l
atarcyrheb-sun16 rhgb crashkernel=auto rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_server01/lv_swap
initrd /initramfs-2.6.32-220.el6.x86_64.img
[root@server01 boot]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 6.2 (Santiago)
[root@server01 boot]# reboot
重新启动画面上可以选择从哪个内核登入
[root@server01 ~]#
[root@server01 ~]#
[root@server01 ~]# uname -r
2.6.32-279.el6.x86_64
[root@server01 ~]# uname -a
Linux server01 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@server01 ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 6.2 (Santiago) #########实际上我们已经升级内核为6.3版本的内核了,可以更改该文件标示为6.3
[root@server01 ~]#rpm -ivh kernel-2.6.32-279.19.1.el6.src.rpm ####内核源码包
1:kernel ########################################### [100%]
[root@server01 ~]# cd rpmbuild/SPECS
[root@server01 SPECS]# ll
total 2248
-rw-r--r--. 1 mockbuild mockbuild 2298057 Apr 12 05:18 kernel.spec
[root@server01 SPECS]# rpmbuild -bb --target=x86_64 kernel.spec
[root@server01 SPECS]# rpmbuild -bp --target=x86_64 kernel.spec
Building target platforms: x86_64
Building for target x86_64
error: Failed build dependencies:
xmlto is needed by kernel-2.6.32-279.19.1.el6.x86_64
asciidoc is needed by kernel-2.6.32-279.19.1.el6.x86_64
elfutils-devel is needed by kernel-2.6.32-279.19.1.el6.x86_64
binutils-devel is needed by kernel-2.6.32-279.19.1.el6.x86_64
newt-devel is needed by kernel-2.6.32-279.19.1.el6.x86_64
python-devel is needed by kernel-2.6.32-279.19.1.el6.x86_64
audit-libs-devel is needed by kernel-2.6.32-279.19.1.el6.x86_64
hmaccalc is needed by kernel-2.6.32-279.19.1.el6.x86_64
[root@server01 SPECS]# rpmbuild -bp --target=x86_64 kernel.spec
Building target platforms: x86_64
Building for target x86_64
error: Failed build dependencies:
asciidoc is needed by kernel-2.6.32-279.19.1.el6.x86_64
newt-devel is needed by kernel-2.6.32-279.19.1.el6.x86_64
[root@server01 ~]# rpm -ivh newt-0.52.11-3.el6.src.rpm
1:newt ########################################### [100%]
[root@server01 SPECS]# rpmbuild -bb --target=x86_64 newt.spec
Building target platforms: x86_64
Building for target x86_64
error: Failed build dependencies:
popt-devel is needed by newt-0.52.11-3.el6.x86_64
slang-devel is needed by newt-0.52.11-3.el6.x86_64
docbook-utils is needed by newt-0.52.11-3.el6.x86_64
[root@server01 SPECS]# rpmbuild -bb --target=x86_64 slang.spec
Building target platforms: x86_64
Building for target x86_64
error: Failed build dependencies:
libpng-devel is needed by slang-2.2.1-1.el6.x86_64
pcre-devel is needed by slang-2.2.1-1.el6.x86_64
[root@server01 boot]# more /boot/grub/menu.lst
# 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/vg_server01-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.32-279.19.1.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-279.19.1.el6.x86_64 ro root=/dev/mapper/vg_server01-lv_root rd_NO_LUKS rd_LVM_LV=vg_server01/lv_root LANG=en_US.UTF-8 rd_NO_MD quiet SYS
FONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_server01/lv_swap
initrd /initramfs-2.6.32-279.19.1.el6.x86_64.img
title Red Hat Enterprise Linux Server (2.6.32-279.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=/dev/mapper/vg_server01-lv_root rd_NO_LUKS rd_LVM_LV=vg_server01/lv_root LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=
latarcyrheb-sun16 rhgb crashkernel=auto rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_server01/lv_swap
initrd /initramfs-2.6.32-279.el6.x86_64.img
title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/mapper/vg_server01-lv_root rd_NO_LUKS rd_LVM_LV=vg_server01/lv_root LANG=en_US.UTF-8 rd_NO_MD quiet SYSFONT=
latarcyrheb-sun16 rhgb crashkernel=auto rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_server01/lv_swap
initrd /initramfs-2.6.32-220.el6.x86_64.img
[root@server01 boot]# reboot
[root@server01 ~]# uname -a
Linux server01 2.6.32-279.19.1.el6.x86_64 #1 SMP Thu May 22 01:54:52 CST 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@server01 ~]# uname -r
2.6.32-279.19.1.el6.x86_64
方法三:通过官网源码压缩包升级
[root@server01 ~]# uname -a
Linux server01 2.6.32-279.19.1.el6.x86_64 #1 SMP Thu May 22 01:54:52 CST 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@server01 ~]# ll
-rw-r--r-- 1 root root 95993809 May 22 18:15 linux-2.6.39.tar.gz
[root@server01 ~]# tar -zxvf linux-2.6.39.tar.gz
[root@server01 ~]# cd linux-2.6.39
[root@server01 linux-2.6.39]# ls
arch COPYING crypto drivers fs init Kbuild kernel MAINTAINERS mm README samples security tools virt
block CREDITS Documentation firmware include ipc Kconfig lib Makefile net REPORTING-BUGS scripts sound usr
[root@server01 linux-2.6.39]# mkdir -p /home/2.6.39/out
[root@server01 linux-2.6.39]# make O=/home/2.6.39/out menuconfig #####生成编译内核的config文件
先根据需要选择相关内核需要的模块组件,再选择“保存配置”,通常保存为.config文件
Save an Alternate Configuration File
最后选择“加载配置”
Load an Alternate Configuration File
[root@server01 linux-2.6.39]# cd /home/2.6.39/out/
[root@server01 out]# ll -al
total 244
drwxr-xr-x 4 root root 4096 May 22 18:29 .
drwxr-xr-x 3 root root 4096 May 22 18:18 ..
-rw-r--r-- 1 root root 113762 May 22 18:29 .config
-rw-r--r-- 1 root root 113732 May 22 18:26 .config.old
drwxr-xr-x 5 root root 4096 May 22 18:18 include
-rw-r--r-- 1 root root 509 May 22 18:19 Makefile
drwxr-xr-x 4 root root 4096 May 22 18:18 scripts
lrwxrwxrwx 1 root root 18 May 22 18:19 source -> /root/linux-2.6.39
[root@server01 out]# vi .config ###新增一行
CONFIG_SYSFS_DEPRECATED_V2=y
[root@server01 ~]# cd linux-2.6.39
[root@server01 linux-2.6.39]# make mrproper ########删除之前编译所生成的文件和配置文件,备份文件等
[root@server01 linux-2.6.39]# make O=/home/2.6.39/out
###开始进行编译,编译出来的文件输出到/home/2.6.39/out这个目录,编译过程可能会有一些不存在组件的不兼容的warning,不影响系统需求时可忽略
.................... ######时间较长,会生成4-5G的文件
[root@server01 linux-2.6.39]# sudo make O=/home/2.6.39/out modules_install install ######安装内核模块
.............................
DEPMOD 2.6.39
sh /root/linux-2.6.39/arch/x86/boot/install.sh 2.6.39 arch/x86/boot/bzImage \
System.map "/boot"
ERROR: modinfo: could not find module rfcomm
ERROR: modinfo: could not find module sco
ERROR: modinfo: could not find module bnep
ERROR: modinfo: could not find module l2cap
ERROR: modinfo: could not find module vxspec
ERROR: modinfo: could not find module vxio
ERROR: modinfo: could not find module vxdmp
ERROR: modinfo: could not find module exportfs
ERROR: modinfo: could not find module vmware_balloon
[root@server01 linux-2.6.39]# more /boot/grub/menu.lst
# 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/vg_server01-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.39)
root (hd0,0)
kernel /vmlinuz-2.6.39 ro root=/dev/mapper/vg_server01-lv_root rd_NO_LUKS r
d_LVM_LV=vg_server01/lv_root LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16
crashkernel=auto rd_NO_DM KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_server01/lv_swa
p
initrd /initramfs-2.6.39.img
...................
[root@server01 linux-2.6.39]# reboot
[root@server01 ~]# uname -a
Linux server01 2.6.39 #1 SMP Thu May 22 19:22:16 CST 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@server01 ~]# uname -r
2.6.39
[root@server01 ~]# cd /boot
[root@server01 boot]# ll | grep -iE '*img|vmlinuz*'
-rw-r--r--. 1 root root 15998033 Mar 13 2013 initramfs-2.6.32-220.el6.x86_64.img
-rw-r--r-- 1 root root 16134024 May 22 04:07 initramfs-2.6.32-279.19.1.el6.x86_64.img
-rw-r--r-- 1 root root 16231307 May 21 15:07 initramfs-2.6.32-279.el6.x86_64.img
-rw-r--r-- 1 root root 13778552 May 22 19:35 initramfs-2.6.39.img ####### 一般被用来临时的引导硬件到实际内核vmlinuz能够接管并继续引导的状态
lrwxrwxrwx 1 root root 20 May 22 19:34 vmlinuz -> /boot/vmlinuz-2.6.39
-rwxr-xr-x. 1 root root 3938800 Nov 9 2011 vmlinuz-2.6.32-220.el6.x86_64
-rwxr-xr-x 1 root root 3942480 May 22 02:31 vmlinuz-2.6.32-279.19.1.el6.x86_64
-rwxr-xr-x 1 root root 3986992 Jun 14 2012 vmlinuz-2.6.32-279.el6.x86_64
-rw-r--r-- 1 root root 3898560 May 22 19:34 vmlinuz-2.6.39 ######可引导的、压缩的内核