Solaris 11 IPS hand-on LAB – Managing software Packages
Solaris 11 IPS hand-on LAB – Boot environments
In the last post we created an IPS repository. Let us now see how we can manage the software packages in solaris 11. Now oracle has completely restructured the software management in Solaris 11 to simplify the software package administration. Lets start with some pkg commands.
Publisher Related Commands
To see which publisher configuration the machine is using
a. Local repository
# pkg publisher PUBLISHER TYPE STATUS P LOCATION solaris origin online F file://sol_11_repo/
b. Remote repository
# pkgrepo info -s /net/repo_server/sol_11_repo/ PUBLISHER PACKAGES STATUS UPDATED solaris 4401 online 2012-09-27T22:22:59.530981Z
To set a new publisher configuration
We can also the change the publisher :
# pkg set-publisher -g /net/repo_server2/sol_11_repo/
To check for updates for all the packages
Now we can see if there any available updates in the repository for the software packages already installed in the machine use the pkg update command with -nv option for dry run.
# pkg update -nv
Getting information about packages
To list the packages that are available in the repository :
# pkg list -g /net/repo_server/sol_11_repo/
To list the packages that are currently installed in the system :
# pkg list
We can also do a pkg list on a particular package.
# pkg list top NAME (PUBLISHER) VERSION IFO diagnostic/top 3.8-0.175.1.0.0.24.0 i--
Here check the last column, i in I column -> package is installed f in F column -> package is frozen o in O column -> package is obsolete r in O column -> package is available under new name
To get a detailed info about a package :
# pkg info top Name: diagnostic/top Summary: provides a rolling display of top cpu using processes Category: Applications/System Utilities State: Installed Publisher: solaris Version: 3.8 (3.8beta1) Build Release: 5.11 Branch: 0.175.1.0.0.24.0 Packaging Date: September 4, 2012 05:17:59 PM Size: 229.39 kB FMRI: pkg:[email protected],5.11-0.175.1.0.0.24.0:20120904T171759Z
Use -r to get the package information from the repository. In my case I have a updated top package
# pkg info -r top
To list the contents of the package and the paths, files that will be installed :
# pkg contents top PATH usr usr/bin usr/bin/top usr/share usr/share/man usr/share/man/man1 usr/share/man/man1/top.1
We can search for a package which contains a particular file. For e.g. /etc/default/mpathd file.
# pkg search mpathd INDEX ACTION VALUE PACKAGE basename file etc/default/mpathd pkg:[email protected]
The installation and un-installation of packages in IPS is pretty easy. Let us first see how we can install packages using IPS.
We can do a dry run before installing any package. use the switch -nv for this
# pkg install -nv vim Packages to install: 1 Estimated space available: 5.37 GB Estimated space to be consumed: 52.47 MB Create boot environment: No Create backup boot environment: No Rebuild boot archive: No Changed packages: solaris editor/vim None -> 7.3.600,5.11-0.175.1.0.0.24.0:20120904T172128Z
As shown above we can check whether the package requires a rebuild of boot archive, space required by it etc.. before actually installing it.
Now to actually install the package :
# pkg install vim Packages to install: 1 Create boot environment: No Create backup boot environment: No DOWNLOAD PKGS FILES XFER (MB) SPEED Completed 1/1 1528/1528 7.8/7.8 0B/s PHASE ITEMS Installing new actions 1673/1673 Updating package state database Done Updating image state Done Creating fast lookup database Done
In case of uninstalling a package you can do a dry run as we did for installing it.
# pkg uninstall -nv vim
To actually uninstall an installed package :
# pkg uninstall vim Packages to remove: 1 Create boot environment: No Create backup boot environment: No PHASE ITEMS Removing old actions 1717/1717 Updating package state database Done Updating package cache 1/1 Updating image state Done Creating fast lookup database Done