JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Adding and Updating Oracle Solaris 11.1 Software Packages     Oracle Solaris 11.1 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

Working with Non-Global Zones

Installing Packages in Non-Global Zones

Updating Multiple Non-Global Zones Concurrently

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(1) man page to understand how files with these attributes are 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. Note that setting or unsetting a mediator, changing a variant or facet, or reverting a file can also involve installing, updating, or uninstalling packages. 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. To explicitly request the newest version, use latest for the version portion of the package FMRI.

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] [-C n] [-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 ...

If the pkg_fmri_pattern does not specify the publisher, the first publisher that provides a matching package is used as the installation source. If that publisher does not provide a version of the package that can be installed in this image, then the installation operation fails. Use the pkg list -a command to see which publishers provide a version of the package that can be installed in this image.

The following commands show that an installable version of the package atool is available from a configured publisher, but the publisher that is first in the search order has a version that is not installable in this image.

$ pkg list -a atool
NAME (PUBLISHER)     VERSION    IFO
atool (isvpub)       2.0        ---
$ pkg list -af atool
NAME (PUBLISHER)     VERSION    IFO
atool                1.1        ---
atool (isvpub)       2.0        ---

In this case, the following install command fails. The packaging system finds a match of the pkg_fmri_patternatool” from the publisher that is first in the search order, but that package cannot be installed.

$ pfexec pkg install atool

To install this package, make the pkg_fmri_pattern more specific, as shown in the following examples:

$ pfexec pkg install //isvpub/atool
$ pfexec pkg install atool@2.0

Use the -nv option to see what will be installed before you perform the actual installation.

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. Repositories that require a client SSL certificate cannot be used with this option. This option cannot be used in images that have child images (non-global zones). If non-global zones are installed in this image, use the pkg set-publisher command to add this publisher and origin. This option can be specified multiple times.

When the -g option is specified, publishers that are enabled in the image are preferred when retrieving packages.

In the following example, btool is available from the solaris publisher configured in the image. The btool package is also available from the devtool publisher with repository origin http://pkg.example1.com/, but the devtool publisher is not configured in the image. The following command attempts to install the package from the solaris publisher because the publisher configured in the image is preferred to the -g source when the package is available from the configured publisher.

$ pfexec pkg install -g http://pkg.example1.com/ btool

To install the package from the devtool publisher, specify the publisher name in the pkg_fmri_pattern.

$ pfexec pkg install -g http://pkg.example1.com/ //devtool/btool

In the following example, isvpub is a publisher configured in the image with an origin of /export/isvrepo. The isvpub publisher also publishes packages to a repository at http://pkg.example2.com/, but that origin is not specified for the publisher configured in the image. The following command attempts to install the package from the http://pkg.example2.com/ location because the same publisher provides the package in both locations.

$ pfexec pkg install -g http://pkg.example2.com/ atool

See also the description of publisher stickiness in Adding, Modifying, or Removing Package Publishers.

Use the -C option to install packages in n non-global zones concurrently with the global zone. See Updating Multiple Non-Global Zones Concurrently for an example of using the -C option.

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.

In the command output, note any messages that say a new boot environment has been created. If a new boot environment has been created and activated, that is the environment that is booted by default on next reboot if you do not specify the --no-be-activate option.

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.

$ pfexec pkg install --be-name s11amp group/feature/amp
           Packages to install:   5
       Create boot environment: Yes
Create backup boot environment:  No

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                5/5       271/271    52.3/52.3    0B/s

PHASE                                          ITEMS
Installing new actions                       410/410
Updating package state database                 Done
Updating image state                            Done
Creating fast lookup database                   Done
Reading search index                            Done
Updating search index                            5/5

A clone of s11_1 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 2012-08-06 15:36
solaris      -      -          44.81M  static 2010-11-07 17:45
solaris11_1  N      /          30.04M  static 2012-07-25 17:10

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.

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

Remember to unmount the s11amp BE.

$ beadm list
BE           Active Mountpoint Space   Policy Created
--           ------ ---------- -----   ------ -------
s11amp       R      /mnt       20.75G  static 2012-08-06 15:36
solaris      -      -          44.81M  static 2010-11-07 17:45
solaris11_1  N      /          30.05M  static 2012-07-25 17:10
$ pfexec beadm unmount s11amp

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 Avoiding Installing Some Packages in a Group Package for information about the avoid list.

$ pfexec pkg install -nv --reject developer/versioning/cvs group/feature/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] [-C n] [-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 newest version of a package, use latest for the version portion of pkg_fmri_pattern.

$ pfexec 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. See Installing a New Package for additional description and examples of the effects of the -g option.

Use the -C option to update packages in n non-global zones concurrently with the global zone. See Updating Multiple Non-Global Zones Concurrently for an example.

In the command output, note any messages that say a new boot environment has been created. If a new boot environment has been created and activated, that is the environment that is booted by default on next reboot if you do not specify the --no-be-activate option.

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.

See Updating an Image for information about the special behavior of the pkg update command when no pkg-fmri is specified, or if the pkg-fmri specified is an asterisk character (*).