Go to main content

Creating Package Repositories in Oracle® Solaris 11.4

Exit Print View

Updated: May 2020

How to Serve Multiple Repositories From a Single Location

This procedure describes using a svc:/application/pkg/depot service. Running a pkg/depot service is more scalable than running the pkg.depotd process under a pkg/server service.

Many of the steps in this procedure are the same as the steps in the previous procedure. See the previous procedure for details.

Before You Begin

To get the svc:/application/pkg/depot SMF service and the pkg.depot-config(8) man page, make sure the pkg:/package/pkg/depot package is installed.

  1. Create a new repository server instance.

    The pkg/server instance provides the file system location of the repository for the pkg/depot instance.

  2. Set the path to the repository.

    Each pkg/server instance that is managed by a particular pkg/depot instance must have a unique pkg/inst_root value.

  3. Check the readonly property for the new instance.

    The default value of the pkg/readonly property is true. If this value has been changed, reset the value to true.

    $ svccfg -s pkg/server:studio listprop pkg/readonly
    pkg/readonly boolean     true
  4. Set the standalone property for the new instance.

    By default, the value of the pkg/standalone property is true. Any pkg/server instances whose pkg/standalone property is set to false can be served from the same location by a pkg/depot service instance.

    $ svccfg -s pkg/server:studio
    svc:/application/pkg/server:studio> setprop pkg/standalone=false
    svc:/application/pkg/server:studio> refresh
    svc:/application/pkg/server:studio> select solaris
    svc:/application/pkg/server:solaris> setprop pkg/standalone=false
    svc:/application/pkg/server:solaris> refresh
    svc:/application/pkg/server:solaris> exit

    Make sure the value of the pkg/inst_root property is unique for each instance of pkg/server whose pkg/standalone property is set to false.

  5. (Optional) Set the port number for the pkg/depot instance.

    By default, the port number of the pkg/depot:default service is 80. To change the port number, set the config/port property of pkg/depot:default. The pkg/port values for pkg/server instances that are managed by the pkg/depot:default service are not used.

  6. (Optional) Set the system name for the pkg/depot instance.

    Set the value of the config/host property of the pkg/depot:default service to the IP address or host name of the system that hosts the repository file system.

    $ svccfg -s pkg/depot:default setprop config/host=pkg.example.com

    If you need to access this repository URI from other systems, specify the host name to use as the argument to the Apache ServerName directive. For more information, see the pkg.depot-config(8) man page.

  7. Start the pkg/depot instance.
    • If the pkg/depot instance is disabled, refresh and enable the instance:
      $ svcadm refresh pkg/depot:default
      $ svcadm enable pkg/depot:default

      If the pkg/depot instance is not online, use the svcs -xvL pkg/depot command to get more information to diagnose and fix the problem.

    • If the pkg/depot instance is online, refresh and restart the instance:
      $ svcadm refresh pkg/depot:default
      $ svcadm restart pkg/depot:default
  8. Test that the repository server is working.

    When users open the http://localhost:80/ location, they see the http://localhost/solaris repository listed with the solaris publisher, and they see the http://localhost/studio repository listed with the solarisstudio publisher.

    If one repository provides packages for multiple publishers, all publishers are listed.

    In the following example, pkg/server instances solaris, ha-cluster, and exa-family all have pkg/standalone set to false and pkg/readonly set to true. The pkg/inst_root location of the pkg/server:solaris instance provides packages from two publishers: solaris and solarisstudio. The config/port value of this pkg/depot instance is set to 88. The following figure shows the display at localhost:88.

    image:Figure shows multiple repositories at one URL.

    The pkg/depot:default service has associated httpd.worker processes. The pkg/server instances do not:

    $ svcs -p pkg/depot pkg/server
    STATE          STIME    FMRI
    online         16:44:31 svc:/application/pkg/server:solaris
    online         16:44:32 svc:/application/pkg/server:ha-cluster
    online         16:44:32 svc:/application/pkg/server:exa-family
    online         16:45:03 svc:/application/pkg/depot:default
                   16:45:02     6834 httpd.worker
                   16:48:04     6948 httpd.worker
                   16:48:04     6949 httpd.worker
                   16:48:04     6950 httpd.worker
                   16:48:05     6953 httpd.worker
                   16:53:11     7043 httpd.worker
  9. Set the publisher origin.

    Set the publisher origin to one of the following values:

    • The unique pkg/inst_root location.

      $ pkg set-publisher -g /var/share/pkgrepos/solarisstudio/ solarisstudio
    • The location defined by the value of config/port plus the pkg/server instance name.

      $ pkg set-publisher -g http://localhost:80/studio/ solarisstudio

Next Steps

If you change the content of a repository that is managed by a pkg/depot instance, as discussed in Updating Your Local Repository and Customizing Your Local Repository, perform both of the following steps:

  • Run pkgrepo refresh on the repository.

  • Run svcadm restart on the pkg/depot instance.

You can create additional instances of the pkg/depot service where each instance hosts one or more repositories.

To generate a standalone configuration rather than configuring pkg/server and pkg/depot service instances, see the pkg.depot-config(8) man page.