pkg commands in Solaris 11

You can manage package management in Solaris 11 using "pkg" 
command which has install, update, search etc. as attributes to
manage packages.
# pkg list      (It will show you all installed packages on server.)
NAME (PUBLISHER)                            VERSION                    IFO
archiver/gnu-tar                            1.27.1-0.175.3.0.0.30.0    i--
audio/audio-utilities                       0.5.11-0.175.3.0.0.30.0    i--
codec/flac                                  1.2.1-0.175.3.0.0.14.0     i--

# pkg list | grep -i x11-info-clients (Grep required package you want to see.)
x11/diagnostic/x11-info-clients             7.7-0.175.3.0.0.30.1483  

# pkg list *incorporation

# pkg list -af entire@0.5.11-0.175.3	(Show you available entire)
NAME (PUBLISHER)                                  VERSION                    IFO
entire                                            0.5.11-0.175.3.35.0.6.0    ---
entire                                            0.5.11-0.175.3.1.0.5.0     i--

# pkg list -af consolidation/X/X-incorporation	(Show you available packages)
NAME (PUBLISHER)                                  VERSION                    IFO
consolidation/X/X-incorporation                   0.5.11-0.175.3.35.0.2.1550 ---
consolidation/X/X-incorporation                   0.5.11-0.175.3.1.0.2.1489  i--

# pkg list -avH consolidation/X/X-incorporation	(Show you installed with complete details)
pkg://solaris/consolidation/X/X-incorporation@0.5.11,5.11-0.175.3.1.0.2.1489:20150921T191842Z i--
You can set publisher from where you will install/update 
packages.
# pkg publisher		(Show you currently set repository)

# pkg set-publisher -O http://192.168.1.10/ solaris	(Will Set repository)

# pkg set-publisher -g http://192.168.1.10:81/ solaris	(Will set another repo)

# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F http://192.168.1.10/
solaris                     origin   online F http://192.168.1.10:81/
Below command will give you lot of information about a package. 
# pkg info entire
          Name: entire
       Summary: Incorporation to lock all system packages to the same build
   Description: This package constrains system package versions to the same
                build.  WARNING: Proper system update and correct package
                selection depend on the presence of this incorporation.
                Removing this package will result in an unsupported system.
      Category: Meta Packages/Incorporations
         State: Installed
     Publisher: solaris
       Version: 0.5.11 (Oracle Solaris 11.3.1.5.0)
 Build Release: 5.11
        Branch: 0.175.3.1.0.5.0
Packaging Date: October  6, 2015 02:00:51 PM
          Size: 5.46 kB
          FMRI: pkg://solaris/entire@0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z

# pkg history		(View pkg command history)
	
# pkg history -l	(View pkg command history with details)
Install packages using "pkg install" commands.
# pkg install X-incorporation

# pkg install X-incorporation@latest	(It will install latest one available)

# pkg install -nv X-incorporation	(It will be a dry run)

# pkg install -nv pkg://solaris/x11/header
If you want to update server then use "pkg update" command:
# pkg update

# pkg update -nv	(It will do a dry run, Give you details what will be upgraded but not update anything)
root@d32p-ora-db31:~# pkg update -nv
            Packages to update:        5
     Estimated space available: 88.76 GB
Estimated space to be consumed: 81.55 MB
       Create boot environment:       No
Create backup boot environment:      Yes
          Rebuild boot archive:       No

----
----
----
Same can be done with one package if you want to update. 
# pkg update consolidation/X/X-incorporation

# pkg update -nv consolidation/X/X-incorporation	(Dry run)
If you want to update entire then try this one. You can also 
check available entire before upgrading.
# pkg update -nv entire@0.5.11-0.175.3.35.0.6.0

# pkg list -af entire@0.5.11-0.175.3
NAME (PUBLISHER)                                  VERSION                    IFO
entire                                            0.5.11-0.175.3.35.0.6.0    ---
entire                                            0.5.11-0.175.3.1.0.5.0     i--
Sometimes, you don't want to update few packages while upgrading
whole server. In that case you can freeze that package and then
run
update. It will skip freezed package.

You can unfreez after your update.
# pfexec pkg freeze -c "Downgrade to avoid bug" consolidation/X/X-incorporation
consolidation/X/X-incorporation was frozen at 0.5.11-0.175.3.1.0.2.1489:20150921T191842Z

# pfexec pkg unfreeze consolidation/X/X-incorporation
consolidation/X/X-incorporation was unfrozen.

Leave a Reply

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