Creating a local OmniOS repository

      No Comments on Creating a local OmniOS repository

Sometimes it is a good idea or even necessary to have a local mirror of OmniOS available, i.e. if you do not want to allow your severs direct access to the outside world. Setting up a local OmniOS repository is rather simple.

1. Create a local package repo

To create an empty repo, run pkgrepo:

pkgrepo create /path/to/repo

2. Grab packages from remote repo

To mirror a remote repository to the newly created local repository, you can use:

pkgrecv -s -d /path/to/repo '*'

You could, of course, also restrict it to individual packages or exclude certain packages.

3. Update the local repository

Updating the local repository is essentially the same as downloading it. Re-run pkgrecv and new packages will be fetched. Don’t forget to run refresh on the repo afterwards to catalog any new packages found in the repository and update search indexes:

# pkgrecv -s -d /path/to/repo omnios '*'
# pkgrepo -s /path/to/repo refresh

4. Add the local repository as a publisher

You need to tell your server to use your local repository instead of the upstream one:

# pkg set-publisher -G '*' -g file:///path/to/repo/ omnios

For a more comprehensive documentation of the available options to set-publisher have a look at the ‘Configuring Publishers’ page at Oracle.

5. Refresh publisher metadata and install packages

After refreshing the publisher metadata you are ready to install packages from your local repository

# pkg refresh --full
# pkg install <packagename>

6. A note on mirroring

Creating a mirror of works the same as any other repository. Be sure, however, to use the -m all-versions flag when downloading the packages into the local repo:

# pkgrepo create /path/to/
# pkgrecv -s -d  file:///mnt/rpm-repo/omnios/ -m all-versions '*'

More options to pkgrecv can be found at Oracle’s pkgrecv manpage. To enable the local repository on your machine, run

# pkg set-publisher -G '*' -g file:///path/to/

Resources and further reading:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.