Software Package Administration

Both Sun Microsystems and third-party vendors deliver software as easily manipulated collections of files and executable installation/removal procedures referred to as packages.

Software packages can be installed on or removed from standalone systems or servers in a fairly straightforward manner, as both the root and /usr file systems are local.

Package Tools

Solaris 9 package tools provide a convenient mechanism for installing and removing packaged software. These are standard Unix commands and are accessible through the shell command line interface. In addition, the system administration tool, admintool, the Product Registry tool and the Web Start program provide a graphical user interface (GUI) for installing and removing packages.

The most commonly used command line package tools are:

pkgadd--Used to install packages

pkginfo and pkgparam--Used to display information about packages

pkgchk - Used to check the proper installation of a package

pkgrm--Used to remove a package

Installing A Package Using The pkgadd Command

The pkgadd command can install a package from disk or CD-ROM. Typically, software obtained through the network or from magnetic tape or diskette is coped into a spool directory on the system before installation. The default package spool directory is /var/spool/pkg, but any location with adequate free space can be used.

To install one or more packages located in the default spool directory using the pkgadd command, only the package names need to be specified as command line arguments. For example, to install the SUNWzipS package, the following command is used:

# pkgadd SUNWzipS

Processing package instance <SUNWzipS> from </var/spool/pkg>
Source for the Info-Zip (zip) compression utility
(sparc) 11.9.0,REV=2001.10.18.00.44
.
.
.

Using </> as the package base directory.
## Processing package information.


## Processing system information.
3 package pathnames are already properly installed.
## Verifying package dependencies.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
permission during the process of installing this package.

Do you want to continue with the installation of <SUNWzipS> [y,n,?] y

Installing Source for the Info-Zip (zip) compression utility as <SUNWzipS>
## Installing part 1 of 1.
4939 blocks
Installation of <SUNWzipS> was successful.
#

If a package was spooled onto the system into a different directory, the alternate spool directory is specified using the –d command line argument. For example, if the /tmp directory was used to spool the SUNWzipS package onto the system, use the following command to install the package:

pkgadd –d /tmp SUNWzipS

To install a package located on CD-ROM, the –d command line argument is used to specify the pathname to the CD-ROM drive. For example, the pkgadd command can be used to install package SUNWzipS from a CD-ROM mounted at /cdrom/cdrom0.

pkgadd –d /cdrom/cdrom0 SUNWzipS

Actually, the pkgadd command does not require the name of a package. If no package name is specified, the pkgadd command will prompt with a list of packages that are available in the specified spool directory or on the CD-ROM.

The –s command line argument is used to spool a package into a spool directory instead of installing it. The following command will spool the SUNWzipS package in from 2nd CD-ROM of the Solaris Distribution to the /var/spool/pkg directory.

# pkgadd -s /var/spool/pkg -d /cdrom/sol_9_sparc_2/Solaris_9/Product SUNWzipS
Transferring <SUNWzipS> package instance
#

When using the default spool directory, just the phrase spool can be specified with the -s command line argument.

Obtaining Package Information Using The pkginfo Command

The pkginfo command with no command line arguments displays a list of installed packages. The following example shows a partial listing of installed packages:

# pkginfo
system IPLTadcon Administration Server Console
system IPLTadman Administration Server Documentation
system IPLTadmin Administration Server
system IPLTcons Console Client Base
system IPLTdscon Directory Server Console
.
.
.
system SUNWzip The Info-Zip (zip) compression utility
system SUNWzipS Source for the Info-Zip (zip) compression utility
system SUNWzlib The Zip compression library
system SUNWzlibx The Zip compression library (64-bit)
system SUNWzsh Z shell (zsh)
#

Each software package includes a file named pkginfo that contains various information about the package. It is also used to store information generated during and after installation, such as installation date and a list of any patches applied to the package. To view the contents of the pkginfo file for a particular package, use the pkginfo command and specify the –l command line argument along with the name of the package. For example, to display the pkginfo file for the SUNWast package, use the following pkginfo command:

# pkginfo -l SUNWzipS

   PKGINST:  SUNWzipS
      NAME:  Source for the Info-Zip (zip) compression utility
  CATEGORY:  system
      ARCH:  sparc
   VERSION:  11.9.0,REV=2001.10.18.00.44
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  Source for the Info-Zip (zip) compression utility
    PSTAMP:  sfw8120011018004824
  INSTDATE:  Jul 19 2002 09:47
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:    326 installed pathnames
                 3 shared pathnames
                30 directories
                 1 executables
              5012 blocks used (approx)
#

TIP

The pkginfo file, along with other package-related files for each installed package, is located under the /var/sadm/pkg directory in subdirectories with the same name as the packages.

Obtaining Package Information Using The pkgparam Command

Specific parameters associated with a particular package can be displayed by using the pkgparam command. The following examples list parameters of the SUNWcsu package:

# pkgparam SUNWrcmds ARCH
sparc
# pkgparam SUNWrcmds VERSION
11.9.0,REV=2001.10.18.00.44
#

Checking A Package Using The pkgchk Command

The integrity of the files and directories associated with a package can be checked by using the pkgcghk command. Any discrepancies are displayed. For example, the group associated with the zipcloak.c file was changed to root to create a discrepancy:

# pkgchk SUNWzipS
ERROR: /usr/share/src/zip/zipcloak.c
group name <bin> expected <root> actual
#

Removing A Package Using The pkgrm Command

The pkgrm command is used to remove installed packages. To remove one or more packages, only the package names need to be specified as command line arguments. For example, to remove the SUNWast package, the following command is used:

# pkgrm SUNWzipS

The following package is currently installed:


   SUNWzipS        Source for the Info-Zip (zip) compression utility
                   (sparc) 11.9.0,REV=2001.10.18.00.44

Do you want to remove this package? y

## Removing installed package instance <SUNWzipS>
## Verifying package dependencies.
## Processing package information.
## Removing pathnames in class <none>
.
.
.
/usr/share/src/zip/LICENSE
/usr/share/src/zip/INSTALL
/usr/share/src/zip/CHANGES
/usr/share/src/zip/BUGS
/usr/share/src/zip
/usr/share/src <shared pathname not removed>
/usr/share <shared pathname not removed>
/usr <shared pathname not removed>
## Updating system information.

Removal of <SUNWzipS> was successful.
#

The Software Installation Database

The Software Installation Database is an ASCII file used by the package administration tools to record the files and directories associated with packages. When the pkgadd command installs package components, it adds an entry in the Software Installation Database for each file and directory. Likewise, when the pkgrm command removes package components, the entries in the Software Installation Database entries associated with the package components are removed. The pkgchk command uses this information to verify package integrity.

The Software Installation Database is stored in the /var/sadm/install/contents file. File and directory entries consist of the following fields:

Entries for symbolic links, special files and other components use variations of this format. The Software Installation Database should not be edited. However entries can be manually added using the installf(1M) command or removed using the removef(1M) command.

Package Administration Using Graphical Tools

Although it is not covered by the test objectives for 311-014, the system administration tool, admintool, the Product Registry tool and the Web Start program can be used to install and remove packages.

The admintool command provides a Software window as shown in Figure1. To install a package, select Add from the Edit pull-down menu. The same information obtained from the pkginfo command can also be obtained using the admintool command. To view selected contents of the pkginfo file for a particular package, highlight the package name in the list and click on the Show Details button. An installed package can also be removed using the admintool command. To delete a package, highlight the package name in the list and select Delete from the Edit pull-down menu. The admintool command calls the pkgrm command and opens a window to display the results.

Figure 1 - The Admintool: Software window

The Product Registry tool is a new utility. It is started by entering the following command:

# prodreg &

The Product Registry window is shown in Figure 3.2. To install a package, click on the New Install button. To obtain more information about a package, click on the package name. Details about the package will be displayed in the More Information window. To remove a package, click on the package name then click on the Uninstall button.

Figure 2 - The Product Registry Tool

Web Start can also be used in install or remove packages. Insert one of the Solaris 9 distribution CDs or DVD in the local drive. Then execute the installer program located in the top directory of the CD or DVD.