Setting up an OpenSolaris pkg repository mirror

by on August 21, 2009 · 1 comment

Downloading OpenSolaris packages from pkg.opensolaris.org is extremely slow, at least here in Germany. As we were planning to upgrade our OpenSolaris boxes from 2008.11 to 2009.06 during a downtime, we needed a significant speedup.

Package Repository Mirrors

Fortunately, it’s pretty simple to setup a mirror yourself. Just grab the 7.2 GB disk image of the complete repository (from a OpenSolaris mirror nearby), copy it to your harddrive and get the preinstalled pkg server running. Then you’re only one command away from actually using it. Here are the steps, one by one in detail:

Get the repository image onto your local hard drive

First, create a file system to keep it out of your boot environment clones:

pfexec zfs create -o compression=on -o atime=off rpool/export/pkg

Then, download the osol-repo-0906-full.iso image of the OpenSolaris pkg repository from a nearby mirror:

wget http://mirror.netcologne.de/opensolaris/2009/06/osol-repo-0906-full.iso

and mount it to be able to copy its contents to your local hard drive using rsync

pfexec mount -F hsfs `pfexec lofiadm -a ~/osol-repo-0906-full.iso` /mnt
pfexec rsync -aP /mnt/repo /export/pkg/

Edit your repo settings

pfexec vi /export/pkg/repo/cfg_cache

replacing

origins = http://pkg.opensolaris.org/release

with

 origins = http://[your hostname of your package server]

Configure and start the pkg-server

svccfg import /var/svc/manifest/application/pkg-server.xml
svccfg -s application/pkg/server setprop pkg/inst_root=/export/pkg/repo
svccfg -s application/pkg/server setprop pkg/readonly=true
svcadm enable pkg-server

Use it

Now you can configure your OpenSolaris clients to use your own package repository server as mirror:

pfexec pkg set-authority -m http://[your hostname of your package server] opensolaris.org

Using a local mirror reduced the install time of the sunstudioexpress package from roughly half an hour to 2 minutes.

Did you enjoy this article? Get new articles for free by email:

Comments