Go to main content

Creating Package Repositories in Oracle® Solaris 11.4

Exit Print View

Updated: May 2020

Customizing Your Local Repository

You can use the pkgrecv command to add packages and their publisher data to your repository. You can use the pkgrepo command to remove packages and publishers from your repository.

Adding Packages to Your Repository

You can add publishers to a repository. For example, you could maintain solaris, ha-cluster, and solarisstudio packages in one repository.

If you add custom packages, publish those packages under a custom publisher name. Do not publish custom packages as an existing publisher such as solaris. If you publish packages that do not have a publisher specified, those packages will be added to the default publisher for the repository. Publish custom packages to a test repository with the correct default publisher. Then use the pkgrecv command to add those packages and their publisher information to your production repository. See Publish the Package in Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.4 for instructions.

In the following example, the isvpub publisher data and all of the packages from the ISVproducts.p5p package archive are added to the local repository. A package archive is a file that contains publisher information and one or more packages provided by that publisher. See Deliver as a Package Archive File in Packaging and Delivering Software With the Image Packaging System in Oracle Solaris 11.4. Most pkgrepo operations are not available for package archives. A package archive contains packages but does not contain repository configuration. However, the pkgrepo list and pkgrepo contents commands work with package archives. The pkgrepo contents command is discussed in Examining Packages In Your Repository.

In the pkgrepo list output, the publisher is shown because it is not the publisher that is highest ranked in search order in this image.

$ pkgrepo -s /tmp/ISVproducts.p5p list
PUBLISHER NAME                                    O VERSION
isvpub    isvtool                                   1.1,5.11:20131120T021902Z
isvpub    isvtool                                   1.0,5.11:20131120T010105Z

A value in the O column indicates whether the package is obsolete (o) or renamed (r).

The following pkgrecv command retrieves all packages from the source repository. If you list names of packages to retrieve, or you specify a pattern other than '*', you should specify the -r option to ensure you retrieve all necessary dependency packages.

$ pkgrecv -s /tmp/ISVproducts.p5p -d /var/share/pkgrepos/solaris '*'
Processing packages for publisher isvpub ...
Retrieving and evaluating 2 package(s)...
PROCESS        ITEMS      GET (MB)      SEND (MB)
Completed        2/2       0.0/0.0          0.0/0

After you change the content of a repository, refresh the repository and restart any package depot server service instance configured for this repository.

$ pkgrepo -s /var/share/pkgrepos/solaris refresh -p isvpub
Initiating repository refresh.
$ svcadm refresh pkg/server:solaris
$ svcadm restart pkg/server:solaris

The following pkgrepo info command shows one package because the two packages that were retrieved are different versions of the same package. The pkgrepo list command shows both packages.

$ pkgrepo -s /var/share/pkgrepos/solaris info
solaris   4768     online           2014-01-02T19:19:06.983979Z
isvpub    1        online           2014-03-20T23:24:37.196773Z
$ pkgrepo -s /var/share/pkgrepos/solaris list -p isvpub
PUBLISHER NAME                                    O VERSION
isvpub    isvtool                                   1.1,5.11:20131120T021902Z
isvpub    isvtool                                   1.0,5.11:20131120T010105Z

Add the new repository location for the isvpub publisher by using the pkg set-publisher command.

If this repository is available from an HTTP interface and you use a browser to view the content of this repository, you can view this new package by specifying the publisher in the location. For example, you can specify http://localhost:81/isvpub/.

Examining Packages In Your Repository

In addition to the pkgrepo info and pkgrepo list commands shown in Adding Packages to Your Repository, you can use the pkgrepo contents command to examine the content of packages in your repository.

For a single package, the output from the pkgrepo contents command is the same as the output from the pkg contents -m command. The pkgrepo contents command displays the output for each matching package in the specified repository, while the pkg contents command displays output only for versions of matching packages that are installable in this image. If you specify the -t option, the pkgrepo contents command shows only the specified actions.

The following example does not need to specify the version of the package because only one version of this package exists in the specified repository. This package contains depend actions to provide the set of Oracle Solaris packages required for installation and operation of Oracle Database 12.

$ pkgrepo -s http://pkg.oracle.com/solaris/release/ \
contents -t depend oracle-rdbms-server-12cR1-preinstall
depend fmri=x11/library/libxi type=group
depend fmri=x11/library/libxtst type=group
depend fmri=x11/session/xauth type=group
depend fmri=compress/unzip type=require
depend fmri=developer/assembler type=require
depend fmri=developer/build/make type=require

Removing Packages From Your Repository

Do not remove packages that are delivered by an Oracle publisher. Updating Systems and Adding Software in Oracle Solaris 11.4 shows methods for installing only the packages you want and avoiding installing packages that you do not want.

You can use the pkgrepo remove command to remove packages that were not delivered by an Oracle publisher. You can use the pkgrepo remove-publisher command to remove a publisher and all of the packages delivered by that publisher. See the pkgrepo(1) man page for details. These operations should be performed on a copy of the repository, as described in How to Update a Local IPS Package Repository.