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 more than one package is specified, and if any of the specified packages cannot be installed in this image, then none of the specified packages will be installed.
If a package is on the avoid list, installing it removes it from that list. See Avoiding Installing Some Packages in a Group Package for information about the avoid list.
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.
If the package name 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. See Showing Package Install State Information for information about options of the pkg list command.
$ 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 package name atool from the publisher that is first in the search order, but that package cannot be installed.
$ pkg install atool
To install this package, make the package name more specific, as shown in the following examples:
$ pkg install //isvpub/atool $ pkg install email@example.com
Use the -nv option to see what will be installed before you perform the actual installation. If you receive an error message, see Appendix A, Troubleshooting Package Installation and Update for help.
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 you specify the -g option, publishers that are enabled in the image are preferred when retrieving packages.
If a package that matches the specified package name or package name pattern is available from a publisher that is enabled in the image, and if that same publisher is not found in the location specified by the -g option, the packaging system attempts to install the package from the publisher that is enabled in the image. After install or update, any packages provided by publishers not configured in the image are added to the image configuration without an origin.
If a package that matches the specified package name or package name pattern is available from a publisher that is enabled in the image, and if that same publisher publishes the package in the location specified by the -g option, the packaging system attempts to install the package from the location specified by the -g option.
In the following example, the btool package 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 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.
$ pkg install -g http://pkg.example1.com/ btool
To install the package from the devtool publisher, specify the publisher name in the package name.
$ 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/IPSpkgrepos/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.
$ pkg install -g http://pkg.example2.com/ atool
See also the description of publisher stickiness in Adding, Modifying, or Removing Package Publishers.