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 http://pkg.omniti.com/omnios/r151014/ -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 http://pkg.omniti.com/omnios/r151014/ -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 ms.omniti.com
Creating a mirror of ms.omniti.com
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/ms.omniti.com/ # pkgrecv -s http://pkg.omniti.com/omniti-ms/ -d file:///mnt/rpm-repo/omnios/ms.omniti.com/ -m all-versions '*'
More options to pkgrecv
can be found at Oracle’s pkgrecv manpage. To enable the local ms.omniti.com
repository on your machine, run
# pkg set-publisher -G '*' -g file:///path/to/ms.omniti.com/ ms.omniti.com
Resources and further reading:
https://blogs.oracle.com/observatory/entry/quick_local_repository
http://serverfault.com/questions/348139/how-to-manually-download-individual-files-from-the-openindiana-or-solaris-pkg
Pingback: Mirroring OmniOS: The Complete Guide; Part One | Antranig Vartanian