修补和更新Redhat Enterprise Linux/CentOS 5服务器

时间:2020-01-09 10:43:17  来源:igfitidea点击:

问题:您能告诉我如何修补和更新Redhat Enterprise Linux服务器5上的所有内容吗?

解决方法:RHEL 5和CentOS 5都使用yum命令,它是一个交互式的自动更新程序,可用于维护使用rpm的系统。

要升级服务器并应用所有安全补丁,请将更新选项传递给yum命令。
它将更新每个当前安装的软件包。
如果指定了一个或者多个软件包,则Yum仅更新列出的软件包。
在更新软件包时,yum将确保满足所有依赖性。
如果没有软件包与给定的软件包名称匹配,则假定它们是shell程序,然后安装所有匹配项。

Redhat/CentOS升级服务器并应用所有安全补丁

简而言之,以root用户身份执行以下命令:

# yum update

或者,如果配置了sudo:

$ sudo yum update

输出示例:

Loading "rhnplugin" plugin
Loading "installonlyn" plugin
Setting up Update Process
Setting up repositories
rhel-x86_64-server-vt-5   100% |=========================| 1.2 kB    00:00     
rhel-x86_64-server-5      100% |=========================| 1.2 kB    00:00     
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package kernel-devel.x86_64 0:2.6.18-8.1.8.el5 set to be installed
---> Package kernel-headers.x86_64 0:2.6.18-8.1.8.el5 set to be updated
---> Package kernel.x86_64 0:2.6.18-8.1.8.el5 set to be installed
--> Running transaction check
--> Populating transaction set with selected packages. Please wait.
---> Package kernel-devel.x86_64 0:2.6.18-8.el5 set to be erased
---> Package kernel.x86_64 0:2.6.18-8.el5 set to be erased
--> Running transaction check

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
kernel                  x86_64     2.6.18-8.1.8.el5  rhel-x86_64-server-5   14 M
kernel-devel            x86_64     2.6.18-8.1.8.el5  rhel-x86_64-server-5  4.7 M
Updating:
kernel-headers          x86_64     2.6.18-8.1.8.el5  rhel-x86_64-server-5  762 k
Removing:
kernel                  x86_64     2.6.18-8.el5     installed          72 M
kernel-devel            x86_64     2.6.18-8.el5     installed          15 M

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

Total download size: 20 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): kernel-devel-2.6.1 100% |=========================| 4.7 MB    00:04     
(2/3): kernel-headers-2.6 100% |=========================| 762 kB    00:00     
(3/3): kernel-2.6.18-8.1. 100% |=========================|  14 MB    00:12     
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: kernel-devel                 ######################### [1/6] 
  Updating  : kernel-headers               ######################### [2/6] 
  Installing: kernel                       ######################### [3/6] 
  Cleanup   : kernel-headers               ######################### [4/6]
  Cleanup   : kernel-devel                 ######################### [5/6]
  Cleanup   : kernel                       ######################### [6/6]

Removed: kernel.x86_64 0:2.6.18-8.el5 kernel-devel.x86_64 0:2.6.18-8.el5
Installed: kernel.x86_64 0:2.6.18-8.1.8.el5 kernel-devel.x86_64 0:2.6.18-8.1.8.el5
Updated: kernel-headers.x86_64 0:2.6.18-8.1.8.el5
Complete!

使用RHEL 4的说明

您需要使用up2date命令:

# up2date -u