News, tips, partners, and perspectives for the Oracle Solaris operating system

Repo on a Stick

Guest Author

A snapshot of the OpenSolaris release repository has been made available for download as an ISO image, where it can be mounted directly or transfered to a USB stick. This will certainly come in handy if you plan to travel somewhere with limited network access but would like access to the repository. In this entry I'll review setting up a USB stick, which gives you a portable repository. In a follow-up entry I'll look at creating a mirror on local file system, which would greatly improve IPS performance for users on a local network.

Putting the Repository on the USB Stick

Download the repository image, which is just over 7 GB. Obviously you'll need at least an 8 GB USB stick. Once plugged in run rmformat to get its device name:

bleonard@opensolaris:~$ rmformat
Looking for devices...
1. Logical Node: /dev/rdsk/c4t0d0p0
Physical Node: /pci@0,0/pci1179,1@1d,7/storage@3/disk@0,0
Connected Device: MATSHITA DVD-RAM UJ-844S 1.11
Device Type: CD Reader

Bus: USB

Size: <Unknown>

Label: <Unknown>

Access permissions: <Unknown>
2. Logical Node: /dev/rdsk/c6t0d0p0
Physical Node: /pci@0,0/pci1179,1@1a,7/storage@1/disk@0,0
Connected Device: Verbatim STORE N GO 5.00
Device Type: Removable

Bus: USB

Size: 7.6 GB

Label: <Unknown>

Access permissions: Medium is not write protected.

Use the mount command to find the device instance:

bleonard@opensolaris:~$ mount | grep c6t0d0p0
/media/STORE N GO on /dev/dsk/c6t0d0p0:1 read/write/nosetuid/nodevices/hidden/nofoldcase/clamptime/noatime/timezone=18000/dev=9810d0 on Fri Jul 31 11:07:12 200

Then unmount it:

bleonard@opensolaris:~$ rmumount /dev/rdsk/c6t0d0p0:1
/dev/rdsk/c6t0d0p0:1 /dev/dsk/c6t0d0p0:1 unmounted

Now you can copy the ISO to the device:

bleonard@opensolaris:~/Download$ pfexec dd if=osol-repo-0906-full.iso of=/dev/rdsk/c6t0d0p0 ibs=32K obs=32K
234931+1 records in
234931+1 records out
7698249728 bytes (7.7 GB) copied, 759.871 s, 10.1 MB/s

You can see the operation took almost 13 minutes to complete. Optionally you can label the device:

rmformat -b 'repo0906' /dev/rdsk/c6t0d0p0

Using the USB Stick as a Repository

IPS is a network based packaging system, therefore we need to configure an IPS server on the local machine to look at the USB stick as its repository.

Plug the USB stick into the machine that needs access to the repository. It should be automatically mounted into your /media directory.

bleonard@opensolaris:~$ ls /media

Next configure the local package server with the location of the repository (if you are interested in seeing the existing set of properties, run svccfg -s application/pkg/server listprop):

svccfg -s application/pkg/server setprop pkg/inst_root=/media/0906FULL/repo
svccfg -s application/pkg/server setprop pkg/readonly=true

Optionally, change the pkg server's port number from the default of 80. I'm
already running Apache on port 80, so I'll use 81 for the repository

svccfg -s application/pkg/server setprop pkg/port=81

Copy the repo/cfg_cache file to the local file system so it can be edited:

pfexec cp /media/0906FULL/repo/cfg_cache /etc/0906_cfg_cache

Edit the file and change the origins property from http://pkg.opensolaris.org/release  to http://localhost:81. Be sure to include the port number if you changed it (note, if you also want the repository accessible to other machines, then use an IP network-accessible domain name):

origins = http://localhost:81

Configure the package server service to use the local configuration file:

svccfg -s application/pkg/server setprop pkg/cfg_file=/etc/0906_cfg_cache
Refresh the package server service to pickup the configuration changes and then start it:
svcadm refresh application/pkg/server
svcadm enable application/pkg/server

At this point you should be able to browse the local repository at http://localhost:81:

The final step is to configure IPS to access the repository:

pfexec pkg set-publisher -O http://localhost:81 opensolaris.org

You're now free to install packages on a plane. 

For more information, see the README.

Reverting Back

It's simple to switch back to the default release repository:

pfexec pkg set-publisher -O http://pkg.opensolaris.org/release opensolaris.org
The next time you need the "repo on a stick", just plug in the USB and switch the publisher back to http://localhost.
pfexec pkg set-publisher -O http://localhost:81 opensolaris.org

Join the discussion

Comments ( 5 )
  • surizs Friday, August 7, 2009

    How to do this if I already got the multiple ISO files instead of the single full ISO?

    USB stick repo creation is possible using them?

  • Brian Leonard Monday, August 10, 2009

    Surizs, you'll need to somehow merge the ISOs. A quick Google search implied it was possible.

  • Shawn Walker Monday, August 10, 2009

    If you downloaded the multiple ISOs, you'll have to merge the contents first somehow into a single ISO image and then copy that to the USB stick.

    The multiple ISO images were provided for users that intended to copy the contents to a filesystem, or whom could not retrieve such large files for whatever reason.

  • Hosam Al Ali Friday, August 28, 2009

    Hello Mr there is more pkg it's my mirror make mistake or error in Download it from my local repository like firefox, codiena, Java Virtual Machine, etc..... and more more

    I have iso repository full 7GB and it's work for more pkg but for some on like u write his name it's Don't work

  • Daniel Templeton Tuesday, October 5, 2010

    You can speed up the dd significantly by assigning a useful block size. Try bs=65536, for example. The default is 512 bytes.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.