Repo on a Stick

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
0906FULL/

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 server:

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
Comments:

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?

Posted by surizs on August 07, 2009 at 04:39 AM GMT #

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

Posted by Brian Leonard on August 10, 2009 at 08:36 AM GMT #

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.

Posted by Shawn Walker on August 10, 2009 at 03:36 PM GMT #

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

Posted by Hosam Al Ali on August 28, 2009 at 08:13 AM GMT #

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

Posted by Daniel Templeton on October 05, 2010 at 02:51 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
20
21
22
23
24
25
26
27
28
29
30
   
       
Today