The following task map describes the software management tasks that you can do with the package commands.
Task |
Description |
For Instructions |
---|---|---|
Add software packages to the local system |
You can add software packages to the local system with the pkgadd command. | |
Add software packages to a spool directory |
You can add software packages to a spool directory without actually installing the software. | |
List information about all installed software packages |
You can list information about installed packages with the pkginfo command. |
How to List Information About All Installed Packages (pkginfo) |
Check the integrity of installed software packages |
You can verify the integrity of install software packages with the pkgchk command. |
How to Check the Integrity of Installed Software Packages (pkgchk) |
Remove software packages |
You can remove unneeded software packages with the pkgrm command. |
Become superuser or assume an equivalent role.
Remove any already installed packages with the same names as the ones you are adding.
This step ensures that the system keeps a proper record of software that has been added and removed. There might be times when you want to maintain multiple versions of the same application on the system. For strategies on maintaining multiple software copies, see Guidelines for Removing Packages, and for task information, see How to Remove Software Packages (pkgrm).
Add a software package to the system.
# pkgadd -a admin-file -d device-name pkgid ... |
-a admin-file |
(Optional) Specifies an administration file that the pkgadd command should consult during the installation. For details about using an administration file, see Using an Administration File in the previous chapter. |
-d device-name |
Specifies the absolute path to the software packages. device-name can be the path to a device, a directory, or a spool directory. If you do not specify the path where the package resides, the pkgadd command checks the default spool directory (/var/spool/pkg). If the package is not there, the package installation fails. |
pkgid |
(Optional) Is the name of one or more packages, separated by spaces, to be installed. If omitted, the pkgadd command installs all available packages. |
If the pkgadd command encounters a problem during installation of the package, it displays a message related to the problem, followed by this prompt:
Do you want to continue with this installation? |
Respond with yes, no, or quit. If more than one package has been specified, type no to stop the installation of the package being installed. The pkgadd command continues to install the other packages. Type quit to stop the installation.
Verify that the package has been installed successfully.
# pkgchk -v pkgid |
If no errors occur, a list of installed files is returned. Otherwise, the pkgchk command reports the error.
The following example shows how install the SUNWpl5u package from a mounted Solaris 9 CD. The example also shows how to verify that the package files were installed properly.
# pkgadd -d /cdrom/cdrom0/s0/Solaris_9/Product SUNWpl5u . . . Installation of <SUNWpl5u> was successful. # pkgchk -v SUNWpl5u /usr /usr/bin /usr/bin/perl /usr/perl5 /usr/perl5/5.00503 . . . |
If the packages you want to install are available from a remote system, you can manually mount the directory that contains the packages (in package format) and install packages on the local system.
The following example shows how to install software packages from a remote system. In this example, assume that the remote system named package-server has software packages in the /latest-packages directory. The mount command mounts the packages locally on /mnt, and the pkgadd command installs the SUNWpl5u package.
# mount -F nfs -o ro package-server:/latest-packages /mnt # pkgadd -d /mnt SUNWpl5u . . . Installation of <SUNWpl5u> was successful. |
If the automounter is running at your site, you do not need to mount the remote package server manually. Instead, use the automounter path, in this case, /net/package-server/latest-packages, as the argument to the -d option.
# pkgadd -d /net/package-server/latest-packages SUNWpl5u . . . Installation of <SUNWpl5u> was successful. |
The following example is similar to the previous example, except that it uses the -a option and specifies an administration file named noask-pkgadd, which is illustrated in Avoiding User Interaction When Adding Packages. In this example, assume that the noask-pkgadd administration file is in the default location, /var/sadm/install/admin.
# pkgadd -a noask-pkgadd -d /net/package-server/latest-packages SUNWpl5u . . . Installation of <SUNWpl5u> was successful. |
For convenience, you can copy frequently installed packages to a spool directory. If you copy packages to the default spool directory, /var/spool/pkg, you do not need to specify the source location of the package (-d device-name argument) when you use the pkgadd command. The pkgadd command, by default, checks the /var/spool/pkg directory for any packages specified on the command line. Note that copying packages to a spool directory is not the same as installing the packages on a system.
Become superuser or assume an equivalent role.
Remove any already spooled packages with the same names as the packages you are adding.
For information on removing spooled packages, see Example—Removing a Spooled Software Package.
Add a software package to a spool directory.
# pkgadd -d device-name -s spooldir pkgid ... |
-d device-name |
Specifies the absolute path to the software packages. device-name can be the path to a device, a directory, or a spool directory. |
-s spooldir |
Specifies the name of the spool directory where the package will be spooled. You must specify a spooldir. |
pkgid |
(Optional) Is the name of one or more packages, separated by spaces, to be added to the spool directory. If omitted, the pkgadd command copies all available packages. |
Verify that the package has been copied successfully to the spool directory.
$ pkginfo -d spooldir| grep pkgid |
If pkgid is copied correctly, the pkginfo command returns a line of information about the pkgid. Otherwise, the pkginfo command returns the system prompt.
The following example shows how to transfer the SUNWman package from a mounted SPARC Solaris 9 CD to the default spool directory (/var/spool/pkg).
# pkgadd -d /cdrom/cdrom0/s0/Solaris_9/Product -s /var/spool/pkg SUNWman Transferring <SUNWman> package instance |
If packages you want to copy are available from a remote system, you can manually mount the directory that contains the packages, in package format, and copy them to a local spool directory.
The following example shows the commands to do this scenario. In this example, assume that the remote system named package-server has software packages in the /latest-packages directory. The mount command mounts the package directory locally on /mnt, and the pkgadd command copies the SUNWpl5p package from /mnt to the default spool directory (/var/spool/pkg).
# mount -F nfs -o ro package-server:/latest-packages /mnt # pkgadd -d /mnt -s /var/spool/pkg SUNWpl5p Transferring <SUNWpl5p> package instance |
If the automounter is running at your site, you do not have to mount the remote package server manually. Instead, use the automounter path, in this case, /net/package-server/latest-packages, as the argument to the -d option.
# pkgadd -d /net/package-server/latest-packages -s /var/spool/pkg SUNWpl5p Transferring <SUNWpl5p> package instance |
The following example shows how to install the SUNWpl5p package from the default spool directory. When no options are used, the pkgadd command searches the /var/spool/pkg directory for the named packages.
# pkgadd SUNWpl5p . . . Installation of <SUNWpl5p> was successful. |
List information about installed packages with the pkginfo command.
$ pkginfo |
The following example shows the pkginfo command to list all packages installed on a local system, whether that system is a standalone or server. The output shows the primary category, package name, and the description of the package.
$ pkginfo system SUNWaccr System Accounting, (Root) system SUNWaccu System Accounting, (Usr) system SUNWadmap System administration applications system SUNWadmc System administration core libraries . . . |
$ pkginfo -l SUNWcar PKGINST: SUNWcar NAME: Core Architecture, (Root) CATEGORY: system ARCH: sparc.sun4u VERSION: 11.9.0,REV=2002.04.06.15.27 BASEDIR: / VENDOR: Sun Microsystems, Inc. DESC: core software for a specific hardware platform group PSTAMP: crash20020406153633 INSTDATE: Nov 19 2002 14:49 HOTLINE: Please contact your local service provider STATUS: completely installed FILES: 111 installed pathnames 36 shared pathnames 40 directories 56 executables 18843 blocks used (approx) |
Become superuser or assume an equivalent role.
Check the status of an installed package.
# pkgchk -a| -c -v pkgid ... # pkgchk -d spooldir pkgid ... |
-a |
Specifies to audit only the file attributes, that is, the permissions, rather than the file attributes and contents, which is the default. |
-c |
Specifies to audit only the file contents, rather than the file contents and attributes, which is the default. |
-v |
Specifies verbose mode, which displays file names as they are processed. |
-d spooldir |
Specifies the absolute path of the spool directory. |
pkgid |
(Optional) Is the name of one or more packages, separated by spaces. If you do not specify a pkgid, all the software packages installed on the system are checked. |
The following example shows how to check the contents of a package.
# pkgchk -c SUNWbash |
If no errors occur, the system prompt is returned. Otherwise, the pkgck command reports the error.
The following example shows how to check the file attributes of a package.
# pkgchk -a SUNWbash |
If no errors occur, the system prompt is returned. Otherwise, the pkgck command reports the error.
The following example shows how to check a software package that was copied to a spool directory (/export/install/packages).
# pkgchk -d /export/install/packages ## checking spooled package <SUNWadmap> ## checking spooled package <SUNWadmfw> ## checking spooled package <SUNWadmc> ## checking spooled package <SUNWsadml> |
The checks made on a spooled package are limited because not all information can be audited until a package is installed.
Use the associated tool that you used to add or install a software package to remove or uninstall a software package. For example, if you used the Web Start installer to install software, use the Web Start uninstaller to uninstall sofware.
Do not use the rm command to remove software packages.
Remove an installed package.
# pkgrm pkgid ... |
pkgid identifies the name of one or more packages, separated by spaces, to be removed. If omitted, pkgrm removes all available packages.
This example shows how to remove a package.
# pkgrm SUNWctu The following package is currently installed: SUNWctu Netra ct usr/platform links (64-bit) (sparc.sun4u) 11.9.0,REV=2001.07.24.15.53 Do you want to remove this package? y ## Removing installed package instance <SUNWctu> ## Verifying package dependencies. ## Processing package information. ## Removing pathnames in class <none> . . . |
This example shows how to remove a spooled package.
# pkgrm -s /export/pkg SUNWdmfex.u The following package is currently spooled: SUNWdmfex.u Sun Davicom 10/100Mb Ethernet Driver (64-bit) (sparc.sun4u) 11.9.0,REV=2001.07.24.15.53 Do you want to remove this package? y Removing spooled package instance <SUNWdmfex.u> |