CentOS/Red Hat Linux找出最新可用的更新软件包或内核版本

时间:2020-01-09 10:34:16  来源:igfitidea点击:

问题描述:我知道如何找出CentOS Enterprise Linux 4.6 x86_64下当前正在运行的内核版本,但是如何找出最新的可用内核版本?
我如何确定它是否是最新的?
如何找到名为xyz或内核软件包的软件包的最新发行版?

解决方法:您可以简单地使用yum命令来查找有关CentOS系统下可用的最新版本的更多信息。
在yum存储库中列出所有带有更新的软件包。

yum list更新语法

使用以下语法,并且允许使用通配符(单引号将使您的shell不会扩展全局字符):

yum list updates {package-name}
yum list updates 'package-name*'
yum list updates '*package-name*'

例如,确定内核或php软件包的最新更新版本,请输入:

# yum list updates 'php*'

或者

# yum list updates 'kernel*'

输出示例:

Loading "installonlyn" plugin
Loading "security" plugin
Setting up repositories
Reading repository metadata in from local files
Skipping security plugin, no data
Updated Packages
kernel.i686                              2.6.18-53.1.21.el5     updates

您可以通过键入以下任一命令来列出"当前安装的软件包版本":

# rpm -q kernel

或者

# yum list installed 'kernel*'

或者,您可以列出多个软件包,并用空格隔开:

# yum list installed 'kernel*' 'php*'

输出示例:

Loading "installonlyn" plugin
Loading "security" plugin
Installed Packages
kernel.i686                              2.6.18-53.1.4.el5      installed       
kernel.i686                              2.6.18-53.1.19.el5     installed       
kernel.i686                              2.6.18-53.1.21.el5     installed       
kernel.i686                              2.6.18-53.1.6.el5      installed       
kernel.i686                              2.6.18-8.1.15.el5      installed       
kernel-devel.i686                        2.6.18-8.1.15.el5      installed       
kernel-devel.i686                        2.6.18-53.1.4.el5      installed       
kernel-devel.i686                        2.6.18-53.1.6.el5      installed       
kernel-devel.i686                        2.6.18-53.1.19.el5     installed       
kernel-devel.i686                        2.6.18-53.1.21.el5     installed       
kernel-headers.i386                      2.6.18-53.1.21.el5     installed

最后,您可以使用yum命令本身来应用更新的版本:

# yum update kernel.i686

输出示例:

Loading "installonlyn" plugin
Loading "security" plugin
Setting up Update Process
Setting up repositories
Reading repository metadata in from local files
Skipping security plugin, no data
Resolving Dependencies
Skipping security plugin, no data
--> Populating transaction set with selected packages. Please wait.
---> Package kernel.i686 0:2.6.18-53.1.21.el5 set to be installed
--> Running transaction check

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
kernel                  i686       2.6.18-53.1.21.el5  updates            13 M

Transaction Summary
=============================================================================
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 13 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: kernel                       ######################### [1/1] 

Installed: kernel.i686 0:2.6.18-53.1.21.el5
Complete!

不要忘记重启系统,以便可以引导到最新的内核版本:

# reboot