Go to main content

Creating Package Repositories in Oracle® Solaris 11.4

Exit Print View

Updated: November 2018
 
 

How to Copy a Repository From a zip File

  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. Get the package repository files.

    Download the Oracle Solaris IPS package repository files (*repo*.zip) from the same location where you downloaded the system installation image. In addition to the repository files, download the install-repo.ksh script and the README and checksum .txt files.

    $ ls
    install-repo.ksh           sol-11_3-ga-repo-3of4.zip
    README-zipped-repo.txt     sol-11_3-ga-repo-4of4.zip
    sol-11_3-ga-repo-1of4.zip  sol-11_3-ga-repo.txt
    sol-11_3-ga-repo-2of4.zip

    On the Oracle Technology Network (OTN) site, you can download the install-repo.ksh script and the README and digest .txt files directly. On the My Oracle Support (MOS) and the Oracle Software Delivery Cloud (OSDC) sites, the install-repo.ksh script and the README and checksum .txt files are part of the Repository Installation Guide. For example, in the IPS Repository column of an SRU Index on MOS, select the Installation Guide document. A new page displays that contains the following buttons:

    • Download. Select this button to retrieve the Repository Installation Guide .zip file. The Repository Installation Guide file contains the following files:

      • The install-repo.ksh script.

      • The README-zipped-repo.txt README file that explains how to use the install-repo.ksh script.

      • The digest.txt checksums file for the repository files (*repo*.zip).

      • Text and HTML versions of a README file that describes this particular SRU.

    • View Readme. Select this button to display the README file that describes this particular SRU.

    • View Digest. Select this button to pop up a new window that displays the SHA-1 and MD5 checksums for the Repository Installation Guide .zip file.

  3. Make sure the script file is executable.
    $ chmod +x install-repo.ksh
  4. Run the repository installation script.

    The repository installation script, install-repo.ksh, uncompresses each repository file (*repo*.zip) into the specified directory.

    The install-repo.ksh script optionally performs the following additional tasks:

    • Verifies checksums of the repository files.

      If you do not specify the -c option to verify checksums, verify the checksums manually before you run the repository installation script. Run the following digest command, and compare the output with the appropriate checksum from the digest.txt file:

      $ digest -v -a sha256 *repo*.zip
    • Adds the repository content to existing content if the specified destination already contains a repository.

    • Verifies the final repository.

      If you do not specify the -v option to verify the repository, use the info, list, and verify subcommands of the pkgrepo command to verify the repository after you run the repository installation script.

    • Creates an ISO image file for mounting and distribution.

      If you use the -I option to create an .iso file, the .iso file and the README file that explains how to use the .iso file are in the specified destination directory (-d).

  5. Verify the repository content.

    If you did not specify the -v option in the previous step, 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
Example 1  Creating a New Repository From a zip File

In this example, no repository exists until the .zip files are unpacked. The script can take the following options:

-s

Optional. Specifies the full path to the directory where the *repo*.zip files are located. Default: The current directory.

-d

Required. Specifies the full path to the directory where you want the repository.

-i

Optional. Specifies the files to use to populate this repository. The source directory could contain multiple sets of *repo*.zip files. Default: The newest image available in the source directory.

-c

Optional. Compares the checksums of the *repo*.zip files with the checksums in the specified file. If you specify -c with no argument, the default file used is the digest.txt file for the -i image in the source directory.

-v

Optional. Verifies the final repository.

-I

Optional. Creates an ISO image of the repository in the source directory. Also leaves a mkiso.log log file in the source directory.

-h

Optional. Displays a usage message.

$ ./install-repo.ksh -d /var/share/pkgrepos/solaris -c -v -I
Comparing digests of downloaded files...done. Digests match.
Uncompressing sol-11_3-ga-repo-1of4.zip...done.
Uncompressing sol-11_3-ga-repo-2of4.zip...done.
Uncompressing sol-11_3-ga-repo-3of4.zip...done.
Uncompressing sol-11_3-ga-repo-4of4.zip...done.
Repository can be found in /var/share/pkgrepos/solaris.
Initiating repository verification.
Building ISO image...done.
ISO image can be found at:
/tank/downloads/sol-11_3-ga-repo.iso
Instructions for using the ISO image can be found at:
/var/share/pkgrepos/solaris/README-repo-iso.txt  
$ ls /var/share/pkgrepos/solaris
COPYRIGHT         NOTICES           pkg5.repository   publisher         README-iso.txt

The repository rebuild and verification can take some time, but the repository content is retrievable after you get the “Repository can be found in” message.

If you receive a message that the repository verification could not be done, ensure that Oracle Solaris 11.1.7 or later is installed.

Example 2  Adding to an Existing Repository From a zip File

In this example, the content of the repository zip files is added to the content in an existing package repository.

$ pkgrepo -s /var/share/pkgrepos/solaris info
PUBLISHER PACKAGES STATUS           UPDATED
solaris   4764     online           2014-03-18T05:30:57.221021Z
$ ./install-repo.ksh -d /var/share/pkgrepos/solaris -c -v -I
IPS repository exists at destination /var/share/pkgrepos/solaris
Current version: 0.175.2.0.0.35.0
Do you want to add to this repository? (y/n) y
Comparing digests of downloaded files...done. Digests match.
Uncompressing sol-11_3-ga-repo-1of4.zip...done.
Uncompressing sol-11_3-ga-repo-2of4.zip...done.
Uncompressing sol-11_3-ga-repo-3of4.zip...done.
Uncompressing sol-11_3-ga-repo-4of4.zip...done.
Repository can be found in /var/share/pkgrepos/solaris.
Initiating repository rebuild.
Initiating repository verification.
Building ISO image...done.
ISO image can be found at:
/tank/downloads/sol-11_3-ga-repo.iso
Instructions for using the ISO image can be found at:
/var/share/pkgrepos/solaris/README-repo-iso.txt
$ pkgrepo -s /var/share/pkgrepos/solaris info
PUBLISHER PACKAGES STATUS           UPDATED
solaris   4768     online           2016-06-02T18:11:55.640930Z