page counter next up previous contents
Next: 例行性命令 Up: Mainataing the Kernel Previous: Specifying Kernel Boot Parameters   Contents

Updating Kernel

  1. Check installed kernels
    [root@kvm4 ~]# rpm -q kernel
    kernel-2.6.32-71.el6.x86_64
    [root@kvm4 ~]# uname -r
    2.6.32-71.el6.x86_64
    
  2. Download the kernel packages
    [root@kvm4 ~]# cd /usr/src
    [root@kvm4 src]# wget ftp://deyu.wang/pub/centos6/crt/extra/kernel-*.rpm
    --2012-01-01 17:52:50--  ftp://deyu.wang/pub/centos6/crt/extra/kernel-*.rpm
               => “.listing”
    Resolving deyu.wang... 192.168.122.1
    Connecting to deyu.wang|192.168.122.1|:21... connected.
    Logging in as anonymous ... Logged in!
    ==> SYST ... done.    ==> PWD ... done.
    ==> TYPE I ... done.  ==> CWD (1) /pub/centos6/dag ... done.
    ==> PASV ... done.    ==> LIST ... done.
    
        [ <=>                                   ] 1,589       --.-K/s   in 0.001s  
    
    2012-01-01 17:52:50 (2.69 MB/s) - “.listing” saved [1589]
    
    Removed “.listing”.
    --2012-01-01 17:52:50--  ftp://deyu.wang/pub/centos6/crt/extra/kernel-2.6.32-71.29.1.el6.x86_64.rpm
               => “kernel-2.6.32-71.29.1.el6.x86_64.rpm”
    ==> CWD not required.
    ==> PASV ... done.    ==> RETR kernel-2.6.32-71.29.1.el6.x86_64.rpm ... done.
    Length: 23472196 (22M)
    
    100%[======================================>] 23,472,196  33.2M/s   in 0.7s    
    
    2012-01-01 17:52:51 (33.2 MB/s) - “kernel-2.6.32-71.29.1.el6.x86_64.rpm” saved [23472196]
    
    --2012-01-01 17:52:51--  ftp://deyu.wang/pub/centos6/crt/extra/kernel-firmware-2.6.32-71.29.1.el6.noarch.rpm
               => “kernel-firmware-2.6.32-71.29.1.el6.noarch.rpm”
    ==> CWD not required.
    ==> PASV ... done.    ==> RETR kernel-firmware-2.6.32-71.29.1.el6.noarch.rpm ... done.
    Length: 1207932 (1.2M)
    
    100%[======================================>] 1,207,932   --.-K/s   in 0.03s   
    
    2012-01-01 17:52:51 (33.0 MB/s) - “kernel-firmware-2.6.32-71.29.1.el6.noarch.rpm” saved [1207932]
    
  3. Install a new kernel
    [root@kvm4 src]# rpm -ivh kernel-2.6.32-71.29.1.el6.x86_64.rpm 
    error: Failed dependencies:
    	kernel-firmware >= 2.6.32-71.29.1.el6 is needed by kernel-2.6.32-71.29.1.el6.x86_64
    [root@kvm4 src]# rpm -ivh kernel-firmware-2.6.32-71.29.1.el6.noarch.rpm Preparing...                ########################################### [100%]
       1:kernel-firmware        ########################################### [100%]
    [root@kvm4 src]# rpm -ivh kernel-2.6.32-71.29.1.el6.x86_64.rpm 
    Preparing...                ########################################### [100%]
       1:kernel                 ########################################### [100%]
    
  4. Check installed kernels
    [root@kvm4 src]# rpm -q kernel
    kernel-2.6.32-71.el6.x86_64
    kernel-2.6.32-71.29.1.el6.x86_64
    [root@kvm4 src]# uname -r
    2.6.32-71.el6.x86_64
    
  5. Reboot to the new kernel
    [root@kvm4 src]# cat /boot/grub/menu.lst 
    .....
    default=0
    timeout=2
    #hiddenmenu
    title CentOS Linux (2.6.32-71.29.1.el6.x86_64)
    	root (hd0,0)
    	kernel /vmlinuz-2.6.32-71.29.1.el6.x86_64 ro root=/dev/mapper/vg_kvmusb-root rd_LVM_LV=vg_kvmusb/root rd_LVM_LV=vg_kvmusb/swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto
    	initrd /initramfs-2.6.32-71.29.1.el6.x86_64.img
    title KVM CentOS (2.6.32-71.el6.x86_64)
    	root (hd0,0)
    	kernel /vmlinuz-2.6.32-71.el6.x86_64 ro root=/dev/mapper/vg_kvmusb-root rd_LVM_LV=vg_kvmusb/root rd_LVM_LV=vg_kvmusb/swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto
    	initrd /initramfs-2.6.32-71.el6.x86_64.img
    
  6. Reboot to the new kernel
    [root@kvm4 src]# reboot
    [root@kvm4 ~]# rpm -q kernel
    kernel-2.6.32-71.el6.x86_64
    kernel-2.6.32-71.29.1.el6.x86_64
    [root@kvm4 ~]# uname -r
    2.6.32-71.29.1.el6.x86_64
    
  7. Remove a kernel
    [root@kvm4 src]# rpm -e kernel
    error: "kernel" specifies multiple packages:
      kernel-2.6.32-71.el6.x86_64
      kernel-2.6.32-71.29.1.el6.x86_64
    [root@kvm4 src]# rpm -e kernel-2.6.32-71.el6.x86_64
    [root@kvm4 ~]# rpm -q kernel
    kernel-2.6.32-71.29.1.el6.x86_64
    [root@kvm4 ~]# uname -r
    2.6.32-71.29.1.el6.x86_64
    



2015-04-13