Packaging and Delivering Software With the Image Packaging System in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014
 
 

Deliver the Package

IPS provides three different ways to deliver a package so that users can install the package:

Local file-based repository

Users access this repository over the local network. The publisher origin is the path to the repository, such as /net/host1/export/ipsrepo.

Remote HTTP-based repository

Users access this repository over HTTP or HTTPS. The publisher origin is an address such as http://pkg.example.com/.

Package archive

A package archive is a standalone file. The publisher origin is the path to the archive file, such as /net/host1/export/ipsarchive.p5p.

In each of these cases, the package was already published using the pkgsend publish command as described in Publish the Package. Use the pkgrecv command to retrieve the package to an existing repository or package archive for general use. See the pkgrecv (1) man page for more information. See Copying and Creating Package Repositories in Oracle Solaris 11.2 for information about how to create and maintain a repository for general use.

Deliver to a Package Repository

The following example shows how to deliver the new package from the test repository to a local file repository that has been set up for general use. The get and send sizes are zero because the package in this example is small.

$ pkgrecv -s my-repository -d /net/host1/export/ipsrepo mypkg
Processing packages for publisher mypublisher ...
Retrieving and evaluating 1 package(s)...
PROCESS                                         ITEMS   GET (MB)   SEND (MB)
Completed                                         1/1    0.0/0.0     0.0/0.0

Verify the presence of the package in the new repository:

$ pkgrepo info -s /net/host1/export/ipsrepo
PUBLISHER   PACKAGES STATUS           UPDATED
solaris     4455     online           2013-07-09T23:41:24.312974Z
mypublisher 1        online           2013-07-22T20:57:36.951042Z
$ pkgrepo list -p mypublisher -s /net/host1/export/ipsrepo
PUBLISHER   NAME                    0 VERSION
mypublisher mypkg                     1.0,5.11-0:20130720T005452Z

Use the same pkgrecv command to deliver the package to an HTTP or HTTPS repository. In this case, specify the value of the pkg/inst_root property of the appropriate pkg/server service instance as the -d argument. This repository is served to users by the svc:/application/pkg/server service, which runs pkg.depotd. See the pkg.depotd (1M) man page for more information.

If this image has no child images (non-global zones), users can use the -g option to install the new package, as shown in the following command. The -g option adds the mypublisher publisher to the list of publishers configured in this image.

$ pkg install -g /net/host1/export/ipsrepo mypkg

If this image does have child images, users must configure the mypublisher publisher in the image, as shown in the following command.

$ pkg set-publisher -p /net/host1/export/ipsrepo

Deliver as a Package Archive File

A package archive is a standalone file that contains publisher information and one or more packages provided by that publisher. Delivering packages as a package archive is convenient for users who cannot access your package repositories. Package archives can be easily downloaded from a web site, copied to a USB key, or burned to a DVD.

The pkgrecv command can add packages to package archives from package repositories or add packages to package repositories from package archives. When adding packages to a package repository from a package archive, note that a package archive does not contain repository configuration such as a default publisher prefix. Most pkgrepo subcommands do not work with package archives. The pkgrepo list command works with package archives.

The following command creates a package archive of the mypkg package. Because this archive does not yet exist, you must specify the -a option. By convention, package archives have the file extension .p5p.

$ pkgrecv -s my-repository -a -d myarchive.p5p mypkg
Retrieving packages for publisher mypublisher ...
Retrieving and evaluating 1 package(s)...
DOWNLOAD                                  PKGS       FILES   XFER (MB)   SPEED
Completed                                  1/1         3/3     0.0/0.0  782k/s

ARCHIVE                                              FILES   STORE (MB)
myarchive.p5p                                        14/14      0.0/0.0

If this image has no child images (non-global zones), users can use the -g option to install the new package, as shown in the following command. The -g option adds the mypublisher publisher to the list of publishers configured in this image.

$ pkg install -g myarchive.p5p mypkg

If this image does have child images, users must configure the mypublisher publisher in the image, as shown in the following command.

$ pkg set-publisher -p myarchive.p5p

Package archives can be set as sources of local publishers in non-global zones.

Using Package Repositories and Archives

Use the pkgrepo command to list the newest available packages from a repository or archive:

$ pkgrepo list -s my-repository '*@latest'
PUBLISHER   NAME                                          O VERSION
mypublisher mypkg                                           1.0,5.11-0:20130720T005452Z
$ pkgrepo list -s myarchive.p5p '*@latest'
PUBLISHER   NAME                                          O VERSION
mypublisher mypkg                                           1.0,5.11-0:20130720T005452Z

This output can be useful for constructing scripts to create archives with the latest versions of all packages from a given repository.