Upgrading the Linux kernel
When the kernel of a Linux server is older, the kernel needs to be upgraded.
[Email protected] ~]# uname-r #查看当前Linux内核版本
2.6.32-573.el6.x86_64
[Email protected] ~]# ll/boot/vmlinuz-*
-rwxr-xr-x. 1 root root 4220560 Jul 2015/boot/vmlinuz-2.6.32-573.el6.x86_64
[Email protected] ~]# mount/dev/cdrom/mnt/
Mount:block Device/dev/sr0 is write-protected, mounting read-only
[email protected] ~]# mount
/dev/mapper/volgroup-lv_root on/type ext4 (rw)
Proc On/proc type proc (rw)
Sysfs On/sys type SYSFS (rw)
Devpts on/dev/pts type devpts (rw,gid=5,mode=620)
Tmpfs on/dev/shm type Tmpfs (rw,rootcontext= "System_u:object_r:tmpfs_t:s0")
/DEV/SDA1 on/boot type EXT4 (rw)
/dev/mapper/volgroup-lv_home on/home type EXT4 (rw)
None On/proc/sys/fs/binfmt_misc type Binfmt_misc (rw)
/dev/sr0 on/mnt type iso9660 (RO)
[Email protected] ~]# CD/ETC/YUM.REPOS.D
[Email protected] yum.repos.d]# VI Base.repo
[Base]
Name=centos6
Baseurl=file:///mnt
Enabled=1
Gpgcheck=0
[email protected] boot]# Yum localinstall/mnt/packages/kernel-2.6.32-642.el6.x86_64.rpm
Loaded Plugins:fastestmirror
Setting Up Local Package Process
Examining/mnt/packages/kernel-2.6.32-642.el6.x86_64.rpm:kernel-2.6.32-642.el6.x86_64
marking/mnt/packages/kernel-2.6.32-642.el6.x86_64.rpm as an update to kernel-2.6.32-573.el6.x86_64
Loading mirror speeds from cached hostfile
Resolving Dependencies
--Running Transaction check
---> Package kernel.x86_64 0:2.6.32-642.el6 'll be installed
--processing Dependency:kernel-firmware >= 2.6.32-642.el6 for package:kernel-2.6.32-642.el6.x86_64
--Running Transaction check
---> Package kernel-firmware.noarch 0:2.6.32-573.el6 'll be updated
---> Package kernel-firmware.noarch 0:2.6.32-642.el6 would be a update
--Finished Dependency Resolution
Dependencies resolved
============================================================================
Package Arch Version Repository Size
============================================================================
Installing:
Kernel x86_64 2.6.32-642.el6/kernel-2.6.32-642.el6.x86_64 131 M
Updating for dependencies:
Kernel-firmware Noarch 2.6.32-642.el6 Base M
Transaction Summary
============================================================================
Install 1 package (s)
Upgrade 1 package (s)
Total size:159 M
Total Download size:28 M
Is this OK [y/n]: Y
Downloading Packages:
Running Rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating:kernel-firmware-2.6.32-642.el6.noarch 1/3
Installing:kernel-2.6.32-642.el6.x86_64 2/3
Cleanup:kernel-firmware-2.6.32-573.el6.noarch 3/3
Verifying:kernel-firmware-2.6.32-642.el6.noarch 1/3
Verifying:kernel-2.6.32-642.el6.x86_64 2/3
Verifying:kernel-firmware-2.6.32-573.el6.noarch 3/3
Installed:
Kernel.x86_64 0:2.6.32-642.el6
Dependency Updated:
Kernel-firmware.noarch 0:2.6.32-642.el6
complete!
[email protected] boot]# ll vmlinuz-*
-rwxr-xr-x. 1 root root 4220560 Jul vmlinuz-2.6.32-573.el6.x86_64
-rwxr-xr-x. 1 root root 4264528 13:32 vmlinuz-2.6.32-642.el6.x86_64
After rebooting the system, you can see that the boot menu is one more item.
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/87/25/wKioL1fWDB2Aip5KAAB5Dcn4Da0439.png-wh_500x0-wm_3 -wmp_4-s_4142215816.png "title=" image 1.png "alt=" Wkiol1fwdb2aip5kaab5dcn4da0439.png-wh_50 "/>
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/87/27/wKiom1fWDCvjYi8rAAAQS6vSWF4253.png-wh_500x0-wm_3 -wmp_4-s_1864710411.png "title=" image 2.png "alt=" Wkiom1fwdcvjyi8raaaqs6vswf4253.png-wh_50 "/>
When we upgrade the Linux kernel, we can uninstall the previous kernel version, thereby upgrading the server, if the upgrade later found that the high version is not too stable, you can uninstall the earlier version of the upgrade, but the installation of a more stable version of the Linux kernel.
Uninstalling the Linux kernel
[email protected] ~]# Yum Remove kernel-2.6.32-573.el6.x86_64
Loaded Plugins:fastestmirror
Setting up Remove Process
Resolving Dependencies
--Running Transaction check
---> Package kernel.x86_64 0:2.6.32-573.el6 'll be erased
--Finished Dependency Resolution
Dependencies resolved
============================================================================
Package Arch Version Repository Size
============================================================================
Removing:
Kernel x86_64 2.6.32-573.el6 @anaconda-centos-201508042137.x86_64/6.7 126 M
Transaction Summary
============================================================================
Remove 1 package (s)
Installed size:126 M
Is this OK [y/n]: Y
Downloading Packages:
Running Rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing:kernel-2.6.32-573.el6.x86_64 1/1
Verifying:kernel-2.6.32-573.el6.x86_64 1/1
Removed:
Kernel.x86_64 0:2.6.32-573.el6
complete!
[Email protected] ~]# ll/boot/vmlinuz-*
-rwxr-xr-x. 1 root root 4264528 may 13:32/boot/vmlinuz-2.6.32-642.el6.x86_64
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/87/25/wKioL1fWDIyTEtJQAABpzrzMOH0189.png-wh_500x0-wm_3 -wmp_4-s_213457815.png "title=" image 3.png "alt=" wkiol1fwdiytetjqaabpzrzmoh0189.png-wh_50 "/>
This article is from the "Linux on the Road" blog, be sure to keep this source http://dreamlinuxc.blog.51cto.com/5733156/1851868
Upgrading and uninstalling the Linux kernel