JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Adding and Updating Oracle Solaris 11 Software Packages     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information

Preface

1.  Introduction to the Image Packaging System

2.  IPS Graphical User Interfaces

3.  Getting Information About Software Packages

4.  Installing and Updating Software Packages

Previewing an Operation

Installing and Updating Packages

Boot Environment Options

Installing a New Package

Installing a Package into a New Boot Environment

Rejecting a Package

Updating a Package

Fixing Package Problems

Verifying Package Installation

Fixing Verification Errors

Restoring a File

Uninstalling Packages

5.  Configuring Installed Images

Installing and Updating Packages

The pkg install command installs packages that are not currently installed and updates packages that are already installed. The pkg install command requires one or more package names.

The pkg update command updates installed packages. If you specify a package that is not already installed to the pkg update command, the system does not install that package. The pkg update command takes zero or more names of packages that are already installed. Specifying no package names updates all packages that are installed in the image.

See the preserve and overlay attributes of the file action in the pkg(5) man page to understand how files with these attributes will be handled during installation and update.

Boot Environment Options

A new BE or a backup BE might be created when you install, update, or uninstall a package or revert a file. Within the constraints of the image policy regarding BEs, you can control the creation of new and backup BEs using the options described below. See Boot Environment Policy Image Properties for information about new BEs and backup BEs and how to set image policy regarding BEs.

Use the BE options to force a new BE or backup BE to be created or not created, to give the BE a custom name, and to specify that the new BE should not be activated.

--no-be-activate

If a BE is created, do not set it as the active BE on the next boot. Use the beadm(1M) command to show and change the active BE.

--no-backup-be

Do not create a backup BE.

--require-backup-be

Create a backup BE if a new BE will not be created. Without this option, a backup BE is created based on image policy. See Boot Environment Policy Image Properties for an explanation of when backup BEs are created automatically.

--backup-be-name name

If a backup BE is created, name it name instead of a default name. Use of --backup-be-name implies --require-backup-be.

--deny-new-be

Do not create a new BE. The install, update, uninstall, or revert operation is not performed if a new BE is required.

--require-new-be

Create a new BE. Without this option, a BE is created based on image policy. See Boot Environment Policy Image Properties for an explanation of when BEs are created automatically. This option cannot be combined with --require-backup-be.

--be-name name

If a BE is created, name it name instead of a default name. Use of --be-name implies --require-new-be.

Installing a New Package

By default, the newest version of a package that is compatible with the rest of the image is installed from the first publisher in the publisher search order that offers the package.

If the package is already installed, the package is updated by installing the newest version of the package that is compatible with the rest of the image from the publisher that provided the currently installed version.

If the image has more than one publisher enabled, you can control which publisher provides a package by setting publisher stickiness and search order or by specifying the publisher in the package FMRI. You can also specify the version you want to install in the package FMRI. See Fault Management Resource Identifiers for a description of a package FMRI. See Configuring Publishers for information about setting publisher stickiness and search order.

/usr/bin/pkg install [-nvq] [-g path_or_uri ...]
    [--accept] [--licenses] [--no-index] [--no-refresh] [--no-be-activate]
    [--no-backup-be | --require-backup-be] [--backup-be-name name]
    [--deny-new-be | --require-new-be] [--be-name name]
    [--reject pkg_fmri_pattern ...] pkg_fmri_pattern ...

To install a package from a specific publisher, specify the publisher name in the pkg_fmri_pattern. In the following example, isv.com is the name of the publisher.

# pkg install pkg://isv.com/developer/isvtool

To install a specific version of a package, specify the version information in the pkg_fmri_pattern.

# pkg list -avH vim
pkg://solaris/editor/vim@7.3.254,5.11-0.174.0.0.0.0.504:20110921T002716Z    ---
# pkg install vim@7.3.254,5.11-0.174

To explicitly request the latest version of a package, use latest for the version portion of pkg_fmri_pattern.

# pkg install vim@latest

Use the -g option to temporarily add the specified package repository or package archive to the list of sources in the image from which to retrieve package data. After install or update, any packages provided by publishers not found in the image are added to the image configuration without an origin.

Use the --accept option to indicate that you agree to and accept the terms of the licenses of the packages that are updated or installed. If you do not provide this option, and any package licenses require acceptance, the installation operation fails. Use the --licenses option to display all of the licenses for the packages that are installed or updated as part of this operation.

When you specify the --no-index option, the search indices are not updated after the operation has completed successfully. Specifying this option might save some time if you are installing a large number of packages. When you are finished with all install, update, and uninstall operations, you can use pkg refresh to update the list of available packages and publisher metadata for each publisher specified. If no publishers are specified, the refresh is performed for all publishers.

When you specify the -no-refresh option, the repositories for the image's publishers are not contacted to retrieve the newest list of available packages and other metadata.

Installing a Package into a New Boot Environment


Tip - Explicitly specifying a new BE is the safest way to install or update. See Boot Environment Policy Image Properties for information about when BEs are created.


The new BE is a clone of the current BE with the specified install, uninstall, or update changes applied. The current BE is not modified. The system is not automatically restarted. The new BE is the default boot selection the next time you restart the system. The current BE is still available to be booted.

If you specify the --no-be-activate option, the new BE is not the default boot selection the next time you reboot.

Use the --be-name option to force a new BE to be created or to give the new BE a meaningful name.

# pkg install --be-name s11amp group/feature/amp
           Packages to install:   8
       Create boot environment: Yes
Create backup boot environment:  No

DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                  8/8     640/640    70.9/70.9

PHASE                                        ACTIONS
Install Phase                                942/942

PHASE                                          ITEMS
Package State Update Phase                       8/8
Image State Update Phase                         2/2

PHASE                                          ITEMS
Reading Existing Index                           8/8
Indexing Packages                                8/8

A clone of solaris-174 exists and has been updated and activated.
On the next boot the Boot Environment s11amp will be
mounted on '/'.  Reboot when ready to switch to this updated BE.

# pkg list group/feature/amp
pkg list: no packages matching 'group/feature/amp' installed

The pkg list command reports that the group/feature/amp package is not installed because the group/feature/amp package is not installed in the current BE. The group/feature/amp package is installed in the new s11amp BE.

Use the beadm list command to check that the system has a new active BE named s11amp. The “N” BE is currently booted; the “R” BE is the default on reboot. Use the beadm activate command to change which BE is the default on reboot.

# beadm list
BE           Active Mountpoint Space   Policy Created
--           ------ ---------- -----   ------ -------
s11amp       R      -          20.75G  static 2011-09-23 13:58
solaris      -      -          44.81M  static 2010-11-07 17:45
solaris-151a -      -          158.12M static 2010-11-12 14:37
solaris-174  N      /          30.04M  static 2011-09-02 12:38

Check that the group/feature/amp package is installed in the new BE. The “i” in the I column indicates that the group/feature/amp package is installed.

# beadm mount s11amp /mnt
# pkg -R /mnt list group/feature/amp
NAME (PUBLISHER)       VERSION                      IFO
group/feature/amp      0.5.11-0.174.0.0.0.0.2559    i--

Remember to unmount the s11amp BE.

# beadm list
BE           Active Mountpoint Space   Policy Created
--           ------ ---------- -----   ------ -------
s11amp       R      /mnt       20.75G  static 2011-09-23 13:58
solaris      -      -          44.81M  static 2010-11-07 17:45
solaris-151a -      -          158.12M static 2010-11-12 14:37
solaris-174  N      /          30.05M  static 2011-09-02 12:38
# beadm unmount s11amp
# beadm list
BE           Active Mountpoint Space   Policy Created
--           ------ ---------- -----   ------ -------
s11amp       R      -          20.75G  static 2011-09-23 13:58
solaris      -      -          44.81M  static 2010-11-07 17:45
solaris-151a -      -          158.12M static 2010-11-12 14:37
solaris-174  N      /          30.06M  static 2011-09-02 12:38

Rejecting a Package

Use the --reject option of the pkg install command to prevent packages with names that match the specified pkg_fmri_pattern from being installed. If matching packages are already installed, they are removed as part of this operation. Rejected packages that are the target of group dependencies are placed on the avoid list. See Marking Packages To Be Avoided for information about the avoid list.

# pkg install -nv --reject cvs developer-gnu

Updating a Package

You can use either the install or update subcommand to update an installed package to the newest version of the package that is compatible with the rest of the image from the publisher that provided the currently installed version. To avoid unintentionally installing a package that was not already installed, use the pkg update command to update packages.

If the image has more than one publisher enabled, you can control which publisher provides a package by setting publisher stickiness and search order or by specifying the publisher in the package FMRI. You can also specify the version you want to install in the package FMRI. See Fault Management Resource Identifiers for a description of a package FMRI. See Configuring Publishers for information about setting publisher stickiness and search order.

/usr/bin/pkg update [-fnvq] [-g path_or_uri ...]
    [--accept] [--licenses] [--no-index] [--no-refresh] [--no-be-activate]
    [--no-backup-be | --require-backup-be] [--backup-be-name name]
    [--deny-new-be | --require-new-be] [--be-name name]
    [--reject pkg_fmri_pattern ...] [pkg_fmri_pattern ...]

To explicitly request the latest version of a package, use latest for the version portion of pkg_fmri_pattern.

# pkg update vim@latest

You can specify a package version older than the version that is currently installed to perform an in-place downgrade. Any preserved configuration files that are part of packages to be downgraded and that have been changed since the original version was installed are renamed with the extension .update. For more information about how the package system determines which files to preserve, and how these files are preserved during package upgrades, see “File Actions” in the pkg(5) man page.

Use the -g option to temporarily add the specified package repository or package archive to the list of sources in the image from which to retrieve package data. After install or update, any packages provided by publishers not found in the image are added to the image configuration without an origin.

Use the --accept option to indicate that you agree to and accept the terms of the licenses of the packages that are updated. If you do not provide this option, and any package licenses require acceptance, the update operation fails. Use the --licenses option to display all of the licenses for the packages that are updated as part of this operation.

When you specify the --no-index option, the search indices are not updated after the operation has completed successfully. Specifying this option might save some time if you are installing a large number of packages. When you are finished with all install, update, and uninstall operations, you can use pkg refresh to update the list of available packages and publisher metadata for each publisher specified. If no publishers are specified, the refresh is performed for all publishers.

If you use the pkg update command with no pkg-fmri specified, or if the pkg-fmri specified is an asterisk character (*), all installed packages that have updates available are updated. Use the pkg list -u command to display the list of packages that have updates available. When you specify the -f option when updating all installed packages, the client up-to-date check is not executed.