在刚刚过去的Oracle OOW11上,Oracle发布了最新版本的Solaris操作系统Solaris11,今天就简单介绍下Solaris 5.11下的包管理。相对于之前的版本,Solaris11在包管理方面非常方便,主要通过几个简单的命令完成,下面就结合例子介绍一下。

在Solaris11下,我想安装一个vnc server,我们只需要知道vnc server是包含在SUNWxvnc这个包里面即可通过下面的命令完成。

root@etc-rac02:~# pkg install SUNWxvnc
               Packages to install:     6
           Create boot environment:    No
               Services to restart:     2
DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                  6/6     414/414      3.9/3.9
PHASE                                        ACTIONS
Install Phase                                661/661 
PHASE                                          ITEMS
Package State Update Phase                       6/6 
Image State Update Phase                         2/2 
root@etc-rac02:~# pkg --help
        pkg [options] command [cmd_options] [operands]
Basic subcommands:
        pkg refresh [--full] [publisher ...]
        pkg install [-nvq] [-g path_or_uri ...] [--accept] [--licenses]
            [--no-be-activate] [--no-index] [--no-refresh] [--deny-new-be |
            --require-new-be] [--be-name name] [--reject pkg_fmri_pattern ... ]
            pkg_fmri_pattern ...
        pkg uninstall [-nvq] [--no-be-activate] [--no-index] [--deny-new-be |
            --require-new-be] [--be-name name] pkg_fmri_pattern ...
        pkg update [-fnvq] [-g path_or_uri ...] [--accept] [--licenses]
            [--no-be-activate] [--no-index] [--no-refresh] [--deny-new-be |
            --require-new-be] [--be-name name] [--reject pkg_fmri_pattern ...]
            [pkg_fmri_pattern ...]
        pkg list [-Hafnsuv] [-g path_or_uri ...] [--no-refresh]
            [pkg_fmri_pattern ...]
        pkg version
Advanced subcommands:
        pkg info [-lr] [-g path_or_uri ...] [--license] [pkg_fmri_pattern ...]
        pkg contents [-Hmr] [-a attribute=pattern ...] [-g path_or_uri ...]
            [-o attribute ...] [-s sort_key] [-t action_type ...]
            [pkg_fmri_pattern ...]
        pkg search [-HIaflpr] [-o attribute ...] [-s repo_uri] query
        pkg verify [-Hqv] [pkg_fmri_pattern ...]
        pkg fix [--accept] [--licenses] [pkg_fmri_pattern ...]
        pkg revert [-nv] [--no-be-activate] [--be-name name] [--deny-new-be |
            --require-new-be] (--tagged tag-name ... | path-to-file ...)
        pkg variant [-H] [<variant_spec>]
        pkg change-variant [-nvq] [-g path_or_uri ...] [--accept] [--licenses]
            [--no-be-activate] [--deny-new-be | --require-new-be]
            [--be-name name] </variant_spec><variant_spec>=<instance> ...
        pkg facet [-H] [<facet_spec>]
        pkg change-facet [-nvq] [-g path_or_uri ...] [--accept] [--licenses]
            [--no-be-activate] [--deny-new-be | --require-new-be]
            [--be-name name] </facet_spec><facet_spec>=[True|False|None] ...
        pkg avoid [pkg_fmri_pattern] ...
        pkg unavoid [pkg_fmri_pattern] ...
        pkg property [-H] [<a href=''>propname</a> ...]
        pkg set-property propname propvalue
        pkg add-property-value propname propvalue
        pkg remove-property-value propname propvalue
        pkg unset-property propname ...
        pkg publisher [-HPn] [publisher ...]
        pkg set-publisher [-Ped] [-k ssl_key] [-c ssl_cert]
            [-g origin_to_add|--add-origin=origin_to_add ...]
            [-G origin_to_remove|--remove-origin=origin_to_remove ...]
            [-m mirror_to_add|--add-mirror=mirror_to_add ...]
            [-M mirror_to_remove|--remove-mirror=mirror_to_remove ...]
            [-p repo_uri] [--enable] [--disable] [--no-refresh]
            [--reset-uuid] [--non-sticky] [--sticky]
            [--set-property name_of_property=value]
            [--add-property-value name_of_property=value_to_add]
            [--remove-property-value name_of_property=value_to_remove]
            [--unset-property name_of_property_to_delete]
        pkg unset-publisher publisher ...
        pkg history [-Hl] [-t [time|time-time],...] [-n number] [-o column,...]
        pkg purge-history
        pkg rebuild-index
        pkg update-format
        pkg image-create [-FPUfz] [--force] [--full|--partial|--user] [--zone]
            [-k ssl_key] [-c ssl_cert] [--no-refresh]
            [--variant <variant_spec>=<instance> ...]
            [-g uri|--origin=uri ...] [-m uri|--mirror=uri ...]
            [--facet <facet_spec>=(True|False) ...]
            (-p|--publisher) [<name>=]<repo_uri> dir
        pkg attach-linked [-fnvq] [--accept] [--licenses] [--no-index] [--no-refresh]
            [--no-pkg-updates] [--linked-md-only]
            [--prop-linked <propname>=<propvalue> ...]
            (-c|-p) <li -name> <dir>
        pkg detach-linked [-fnvq] [-a|-l <li -name>] [--linked-md-only]
        pkg list-linked -H
        pkg audit-linked [-a|-l </li><li -name>]
        pkg sync-linked [-nvq] [--accept] [--licenses] [--no-index] [--no-refresh]
            [--no-parent-sync] [--no-pkg-updates]
            [--linked-md-only] [-a|-l <name>]
        pkg property-linked [-H] [-l <li -name>] [propname ...]
        -R dir
        --help or -?
root@etc-rac02:~# pkg set-publisher
root@etc-rac02:~# pkg publisher
PUBLISHER                             TYPE     STATUS   URI
solaris                               origin   online


This entry was posted in 主机 and tagged . Bookmark the permalink.

2 Responses to Solaris11下的包管理

  1. suse says:

    沙发~ From suse-sol SunOS 5.11

    1. before `pkg install`, can use `pkg search` to get the package info.

    root@suse-sol:/home/suse# pkg search vncserver
    basename file usr/bin/vncserver pkg:/x11/server/xvnc@1.0.1-0.151
    basename file opt/SUNWtvnc/bin/vncserver pkg:/desktop/remote-desktop/turbovnc@0.4-

    2. About the publisher add, should add `-g` option since it’s non-default repo.

    # pkg set-publisher -P -g solaris

  2. ricky.zhu says:

    pretty cool, Thanks for the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *