Copying and Creating Package Repositories in Oracle® Solaris 11.2

Exit Print View

Updated: September 2014
 
 

How to Update a Local IPS Package Repository


Note -  You do not need to perform this procedure if you use the svc:/application/pkg/mirror SMF service to periodically update your repository. See How to Automatically Copy a Repository From the Internet for instructions for using the mirror service.
  1. Make a ZFS snapshot of the package repository.

    Make sure you have a current snapshot of the repository to be updated.

    $ zfs list -t all -r rpool/export/IPSpkgrepos/Solaris
    NAME                                          USED  AVAIL  REFER  MOUNTPOINT
    rpool/export/IPSpkgrepos/Solaris             17.6G  78.4G    34K  /export/IPSpkgrepos/Solaris
    rpool/export/IPSpkgrepos/Solaris@initial         0      -  17.6G  -

    If you already have a snapshot of the repository, use the zfs diff command to check whether the snapshot is the same as the repository dataset.

    $ zfs diff rpool/export/IPSpkgrepos/Solaris@initial
    $

    If the zfs diff command produces no output, then the snapshot is the same as its parent dataset, and you can use that snapshot for the update.

    If the zfs diff command produces output, or if you do not have a snapshot of the repository, then take a new snapshot as shown in Step 6 in How to Explicitly Copy a Repository From the Internet. Use this new snapshot for the update.

  2. Make a ZFS clone of the package repository.

    Clone the repository snapshot to create a copy of the repository that you can update.

    $ zfs clone rpool/export/IPSpkgrepos/Solaris@initial rpool/export/IPSpkgrepos/Solaris_tmp
    $ zfs list -r rpool/export/IPSpkgrepos/Solaris/
    NAME                                          USED  AVAIL  REFER  MOUNTPOINT
    rpool/export/IPSpkgrepos/Solaris             17.6G  78.4G    34K  /export/IPSpkgrepos/Solaris
    rpool/export/IPSpkgrepos/Solaris@initial         0      -  17.6G  -
    rpool/export/IPSpkgrepos/Solaris_tmp           76K  78.4G  17.6G  /export/IPSpkgrepos/Solaris_tmp
  3. Update the ZFS clone of the package repository.

    Just as you created the original repository either from a file or from an HTTP location, you can update your repository either from a file or from an HTTP location.

    • Update from a zip file.

      See Example 2–2. If the specified destination already contains a package repository, the content of the zip file is added to the content of the existing repository.

    • Update from an ISO file.
      1. Mount the ISO image.
        $ mount -F hsfs ./sol-11_2-incr-repo.iso /mnt
      2. Copy the ISO file content to the repository clone.

        Use either rsync or tar as shown in How to Copy a Repository From an iso File.

        $ rsync -aP /mnt/repo/ /export/IPSpkgrepos/Solaris_tmp
      3. Unmount the ISO image.
    • Update from a repository.

      Copy content from another repository to the repository clone. 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 /export/IPSpkgrepos/Solaris_tmp \
      --key /path-to-ssl_key --cert /path-to-ssl_cert '*'

      See the pkgrecv(1) man page for more information about the pkgrecv command. Only packages that have changed are updated, so the time to update your repository can be much less than the time to populate the original repository. See the performance tips in Performance Considerations for Copying Repositories.

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

  4. Replace the working repository with the updated clone.
    $ svcadm disable -st pkg/server:solaris
    $ zfs promote rpool/export/IPSpkgrepos/Solaris_tmp
    $ zfs rename rpool/export/IPSpkgrepos/Solaris rpool/export/IPSpkgrepos/Solaris_old
    $ zfs rename rpool/export/IPSpkgrepos/Solaris_tmp rpool/export/IPSpkgrepos/Solaris

    See the svcadm(1M) man page for more information about the svcadm command.

  5. Verify the updated repository.

    Use the pkgrepo verify command to verify the updated repository. See the pkgrepo(1) man page for more information about the pkgrepo verify and pkgrepo fix commands.

  6. Catalog new packages and update search indexes.

    Catalog any new packages found in the newly updated repository and update all search indexes.

    $ pkgrepo refresh -s rpool/export/IPSpkgrepos/Solaris
  7. Make a ZFS snapshot the newly updated clone of the package repository.
    $ zfs snapshot rpool/export/IPSpkgrepos/Solaris@S11U2SRU1
  8. Restart the SMF service.

    If you are providing the repository through an HTTP interface, restart the SMF service. Be sure to specify the appropriate service instance when you restart the service.

    $ svcadm restart pkg/server:solaris
  9. Remove the old repository.

    When you are satisfied that your updated repository is working correctly, you can remove the old repository.

    $ zfs destroy rpool/export/IPSpkgrepos/Solaris_old