现在的位置: 首页 > 综合 > 正文

Solaris下补丁管理

2013年12月04日 ⁄ 综合 ⁄ 共 3223字 ⁄ 字号 评论关闭

在Linux下安装和卸载补丁很多人都很清楚了,特别是使用redhat的系统时.

在Solaris下怎么去管理补丁呢? 其实也很简单的.

一. 概述

   查看补丁安装的目录:  /var/sdam/patch

   安装补丁:  patchadd (2.6版本以上)

   卸载补丁:  patchrm (2.6版本以上)

 

二.  详细描述:

   1. 首先去SUN的网站查询当前的OS需要打哪些补丁

       然后根据实际情况去下载补丁;

   2. 安装补丁前,我们需要将补丁解压到
       /var/tmp下安装(Root用户),

       # cd /var/tmp
       # patchadd 123456-07

       屏幕会显示这些信息:

         Checking installed patches...
  

         Verifying sufficient filesystem capacity

         (dry run method)
        

         Installing patch packages...

       如果当前目录下有123456-07目录,patchadd将

       安装此补丁。补丁安装后,系统会备份原文件,

       如果使用patchadd -d 选项安装补丁, 系统将不

       备份源文件,这意味着你将不能在以后删除此补丁。

 

  3. 验证补丁是否已经安装

      使用Patchadd -p 选项可以检验已安装的patch.
       # patchadd -p
       # patchadd -p |grep  123456-07

      还可以使用showrev -p 命令来查看已经安装的

      补丁. 

 

  4. 卸载补丁

     一般来说补丁安装完毕后我们不需要去卸载.

     因为每个补丁都是对现有程序的功能性或者

    安全性的改进. 如果因为某种情况你想卸载

    某一补丁, 可以使用Patchrm命令来完成.

    # patchrm 123456-07
    Checking installed packages and patches...
    Backing out patch 123456-07...
    Patch 123456-07 has been backed out.

    需要说明一下,在如下三种情况下,补丁将不能卸载:

    1.在安装patch时,用patchadd -d命令指定patchadd

      不备份被更新的文件。这样安装的patch无法删除。

    2.另一Patch需要此Patch,即存在dependence

      (关联性), 如一定要删掉该patch,先删掉另一patch。

    3.要删的patch已被另一更新的patch废弃了. 例如安装

      123456-07补丁后,如果以前安装过123456-06,则
      后者将被前者废弃,也就是说它将不能被删除。

三. 安装Patch时的注意事项

    由于在安装Patch时需要更新文件, 因此Solaris官方推荐

    在安装补丁时进入单用户模式安装. 在某些重要服务器上

    可能带来不便, 因此你完全可以在多用户模式下通过停止

    相关服务进程来完成Patch的安装.

    Sun推出的Patch并不是每个都一定要安装的, 因此需要

    在安装patch前仔细阅读README来确定是否需要安装此

    补丁.另外,某些补丁具有依赖性,需要先安装另一补丁才

    能完成此补丁的安装,这些都会在README中标明.

    总之,安装补丁之前强烈建议你阅读相应的README文件.

     (每个Patch都提供单独的README文件)

四. 安装PATCH过程中出现的问题

     在安装补丁的过程中, 经常出现一些错误提示.例如:
 
       Installation of 123456-07 failed.

        Return code 2
    

    通过Return code我们可以知道错误类型。需要注意

    的是,Return code 2说明此补丁已被安装, Return

    code 8说明此补丁要修复的软件没有被系统安装.因此,

    2和8是完全可以被忽略的错误提示. 下表说明了各个
    Return code对应的错误类型。

Exit code Meaning
0 No error
1 Usage error
2 Attempt to apply a patch that's already been applied
3 Effective UID is not root
4 Attempt to save original files failed
5 pkgadd failed
6 Patch is obsoleted
7 Invalid package directory
8 Attempting to patch a package that is not installed
9 Cannot access /usr/sbin/pkgadd (client problem)
10 Package validation errors
11 Error adding patch to root template
12 Patch script terminated due to signal
13 Symbolic link included in patch
14 NOT USED
15 The prepatch script had a return code other than 0.
16 The postpatch script had a return code other than 0.
17 Mismatch of the -d option between a previous patch install and the current one.
18 Not enough space in the file systems that are targets of the patch.
19 $SOFTINFO/INST_RELEASE file not found
20 A direct instance patch was required but not found
21 The required patches have not been installed on the manager
22 A progressive instance patch was required but not found < tr>
23 A restricted patch is already applied to the package
24 An incompatible patch is applied
25 A required patch is not applied
26 The user specified backout data can't be found
27 The relative directory supplied can't be found
28 A pkginfo file is corrupt or missing
29 Bad patch ID format
30 Dryrun failure(s)
31 Path given for -C option is invalid
32 Must be running Solaris 2.6 or greater
33 Bad formatted patch file or patch file not found
34 The appropriate kernel jumbo patch needs to be installed
35 Later revision already installed

五. 参考资料

  1. Solaris™8

      Operating Environment System Administration I,

      (SA-238)

  2. System Administration Guide, Volume 1,

      (805-7228),Solaris

  3. SunSolve Patch Support Portal

     http://sunsolve.sun.com/pub-cgi/show.pl?target=patchpage

 

抱歉!评论已关闭.