By default, the svc:/application/pkg/mirror SMF service performs a periodic pkgrecv operation from the solaris publisher origins defined in this image to /var/share/pkg/repositories/solaris. This pkgrecv operation starts at 2:30am one day each month. To change this default behavior, configure the service as described in this procedure.
At the end of each successful run of this service, the repository catalogs are refreshed. You do not need to refresh the repository to build a search index.
Because this service runs periodically, the repository is created and also kept updated. You do not need to use the manual repository update instructions shown in this document.
Other systems can set their solaris publisher origin to this automatically updated repository or to a clone of this repository. Only one system needs to have an Internet publisher origin and run the mirror service to automatically receive updates.
By default, the mirror service transfers packages from the solaris publisher configured in the image rooted at /. Although you cannot directly specify publisher origins in the mirror service configuration, you can configure the image root from which to retrieve this information. In that image root, use pkg set-publisher to configure the publisher origins to use as the sources of the pkgrecv transfer for the mirror repository.
If the publisher configuration you want to use for the mirror service is different from the publisher configuration you want to use in this image, create a user image in a shared location (not contained in any BE) and reset the value of the config/ref_image property in the mirror service to that new image, as shown in the following example. The mirror service will use the publisher configuration from the config/ref_image image.
$ svccfg -s pkg/mirror:default setprop config/ref_image = /var/share/pkg/mirror_svc_ref_image $ pkg image-create /var/share/pkg/mirror_svc_ref_image
If you want to update your mirror repository with packages from other publishers in addition to the solaris publisher, reset the value of the config/publishers property in the mirror service, as shown in the following example that shows adding the ha-cluster and solarisstudio publishers.
$ svccfg -s pkg/mirror:default setprop config/publishers = solaris,ha-cluster,solarisstudio
Because this service runs periodically, you should set your publisher origins to a repository that provides regular updates. For Oracle products, you probably want to set your publisher origins to a support repository to retrieve Support Repository Updates (SRUs). In the following example, the -R option is needed only if you are configuring publishers in an alternate image root. The -k and -c options might not be needed, depending on the origin URIs.
$ pkg -R /var/share/pkg/mirror_svc_ref_image set-publisher \ -g https://pkg.oracle.com/solaris/support/ -k ssl_key -c ssl_cert solaris $ pkg -R /var/share/pkg/mirror_svc_ref_image set-publisher \ -g https://pkg.oracle.com/ha-cluster/support/ -k ssl_key -c ssl_cert ha-cluster $ pkg -R /var/share/pkg/mirror_svc_ref_image set-publisher \ -g https://pkg.oracle.com/solarisstudio/support/ -k ssl_key -c ssl_cert solarisstudio
Use one of the following commands to verify the publishers configured in the new image:
$ pkg -R /var/share/pkg/mirror_svc_ref_image publisher $ pkg -R /var/share/pkg/mirror_svc_ref_image publisher solaris ha-cluster solarisstudio
You might want to modify other properties of the mirror service, such as the time the service runs or the location of the mirror repository.
You might want to change the time the service runs to more closely match the time you expect the publisher origins being mirrored to be updated. To change the time the service runs, modify the value of the config/crontab_period property.
To change the location of the mirror repository, modify the value of the config/repository property. If you change the location of the mirror repository, keep the repository in a shared location. See Best Practices for Creating and Using Local IPS Package Repositories. The default location, /var/share/pkg/repositories/solaris, is a shared location, not contained in any BE.
Use the svcs mirror command to check the state of the mirror service.
If you changed any of the configuration of the mirror service, as shown in the svccfg setprop commands in the previous steps, refresh the service to commit the changed values into the running snapshot. If the output from the svcprop -p config mirror command does not show the values you want, make sure the output from the svccfg -s mirror:default listprop config command shows the values you want. Use either svcadm refresh mirror:default or svccfg -s mirror:default refresh to commit the changed values into the running snapshot of the service. Use the svcprop -p config mirror command again to confirm that the service is configured the way you want it configured.
Use the following command to enable the mirror service:
$ svcadm enable mirror:default
Use the svcs mirror command to confirm that the mirror service is online. The service will run at the time set in the config/crontab_period property.
If the service is online, refresh the service to run the service immediately. You should see the svc-pkg-mirror method and the pkgrecv command being run by the pkg5srv user.
Use the svcadm disable mirror command to disable this service. You might want to run this service on only one system to maintain a master repository. On other systems, you probably want to disable this service.
Use the svcs -xvL mirror command to get more information to diagnose and fix the problem.
After the mirror service finishes a run, use the info, list, and verify subcommands of the pkgrepo command to check that the repository has been copied or updated correctly. If the pkgrepo verify command reports errors, try using the pkgrepo fix command to fix the errors. See the pkgrepo(1) man page for more information.
Check the value of the config/crontab_period property of the mirror service to see when the service will run. While the service is running, the svcs -p mirror command shows the service state as online* and shows the processes started by this service. Wait until the service state shows as online and no processes are associated with the service before you verify the repository.
$ zfs snapshot rpool/VARSHARE/pkg/repositories/solaris@sol-11_3_0
You might not want to copy content from multiple publishers at the same time. Instead of setting multiple publishers in one config/publishers property, you could create multiple instances of the pkg/mirror service. For example, the config/publishers property could be set to solaris for the default instance, to ha-cluster for a new pkg/mirror:ha-cluster instance, and to solarisstudio for a new pkg/mirror:solarisstudio instance. Similarly, the config/crontab_period could be set differently for each instance. You could store the content from each publisher in one repository, as shown in this procedure, or you could set a separate config/repository value for each pkg/mirror instance.
See Managing System Services in Oracle Solaris 11.3 for more information about SMF commands.