Go to main content

Copying and Creating Package Repositories in Oracle® Solaris 11.3

Exit Print View

Updated: September 2018
 
 

How to Explicitly Copy a Repository From the Internet

  1. Create a ZFS file system for the new repository.

    Create the repository in a shared location. Set atime to off when you create the repository file system. Consider setting the compression property. See Best Practices for Creating and Using Local IPS Package Repositories.

    $ zfs create -o atime=off rpool/VARSHARE/pkgrepos
    $ zfs create rpool/VARSHARE/pkgrepos/solaris
    $ zfs get atime rpool/VARSHARE/pkgrepos/solaris
    NAME                             PROPERTY  VALUE  SOURCE
    rpool/VARSHARE/pkgrepos/solaris  atime     off    inherited from rpool/VARSHARE/pkgrepos
  2. Create the required repository infrastructure.

    Create the required IPS repository infrastructure so that you can copy the repository. The image files used in the previous method include the repository infrastructure, so this step is not needed. When you copy repository content using the pkgrecv command as described in this method, you need to create the repository infrastructure and then copy the repository content into that infrastructure. See the pkg(5) and pkgrepo(1) man pages.

    $ pkgrepo create /var/share/pkgrepos/solaris
  3. Set the default publisher.
    $ pkgrepo -s /var/share/pkgrepos/solaris get publisher/prefix
    SECTION    PROPERTY                     VALUE
    publisher  prefix                       ""
    $ pkgrepo -s /var/share/pkgrepos/solaris set publisher/prefix=solaris
    $ pkgrepo -s /var/share/pkgrepos/solaris get publisher/prefix
    SECTION    PROPERTY                     VALUE
    publisher  prefix                       solaris
  4. Copy the repository content to the new location.

    Use the pkgrecv command to copy the repository. This operation could affect your network performance. The time required for this operation to complete depends on your network bandwidth and connection speed. See also Performance Considerations for Copying Repositories. If you update this repository later, only the changes are transferred, and the process can take much less time.

    The following command retrieves all versions of all packages from the package repository specified by the -s option to the repository specified by the -d option. If you are copying from a secure site, ensure that the required SSL certificate and key are installed, and specify the required certificate and key options.

    $ pkgrecv -s https://pkg.oracle.com/solaris/support -d /var/share/pkgrepos/solaris \
    --clone -p '*' --key /path-to/key-file --cert /path-to/certificate-file '*'

    The --clone option makes the destination repository an exact copy of the source repository, which is significantly faster than the default pkgrecv copy mode. See the pkgrecv(1) man page for information about the --clone option.

    You should not use the -m latest option for this purpose. Do not try to specify a subset of Oracle Solaris packages to receive. Using a repository that is too sparse can result in errors when users attempt to update their images. See Do Not Subset Repository Content.

    If the pkgrecv operation is interrupted, follow the instructions in Resuming an Interrupted Package Receive.

  5. Verify the new repository content.

    Use the info, list, and verify subcommands of the pkgrepo command to check that the repository has been copied 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.

  6. Snapshot the new repository.
    $ zfs snapshot rpool/VARSHARE/pkgrepos/solaris@sol-11_3_0