System Administration Guide: Basic Administration

ProcedureHow to Add Software Packages (pkgadd)

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.

  2. Remove any already installed packages with the same names as the packages you are adding.

    This step ensures that the system keeps a proper record of software that has been added and removed. Sometimes, you might want to maintain multiple versions of the same application on the system. For strategies on maintaining multiple software copies, see Guidelines for Removing Packages (pkgrm). For task information, see How to Remove Software Packages (pkgrm).

  3. 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 check during the installation. For details about using an administration file, see Using an Administration File.

    -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 from the specified device, directory, or spool directory.

    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.

  4. 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.


Example 20–5 Adding Software Packages From a Mounted CD

The following example shows how install the SUNWpl5u package from a mounted Solaris 10 CD. The example also shows how to verify that the package files were installed properly.


# pkgadd -d /media/Solaris_11/Product SUNWpl5u
	.
	.
	.
Installation of <SUNWpl5u> was successful.
# pkgchk -v SUNWpl5u
/usr
/usr/bin
/usr/bin/perl
/usr/perl5
/usr/perl5/5.8.4
.
.
.


Example 20–6 Installing Software Packages From a Remote Package Server

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. 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.


Example 20–7 Installing Software Packages From a Remote Package Server by Specifying an Administration File

This 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 (pkgadd). 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.


Example 20–8 Installing Software Packages From an HTTP URL

The following example shows how to install a package using an HTTP URL as the device name. The URL must point to a stream-formatted package.


# pkgadd -d http://install/xf86-4.3.0-video.pkg

## Downloading...
..............25%..............50%..............75%..............100%
## Download Complete


The following packages are available:
  1  SUNWxf86r     XFree86 Driver Porting Kit (Root)
                   (i386) 4.3.0,REV=0.2003.02.28
  2  SUNWxf86u     XFree86 Driver Porting Kit (User)
                   (i386) 4.3.0,REV=0.2003.02.28

.
.
.