center of tech

I was looking for a way of speeding up downloads from the IPS repository, and finding a way for OpenSolaris Parties to quickly install software after fresh install, in case of "no internet connections in this class-room, sorry". This is particularly usefull when many people would like to install simultaneously big packages like OpenOffice, NetBeans, or the AMP stack, or environments where people would like to reduce bandwith usage to the standard opensolaris.org IPS server.
A big thank you to Brian Leonard who wrote the first a good example of the man page of pkg.depotd (1m).
I just added a few lines, and removed the details given by Brian.
So, this procedure works well from a fresh OpenSolaris 2009.06 installation (build 111b).
Be aware that step 1 can be quite time consuming: 7GB of download (here from Switzerland), and 40 minutes are needed to copy approximatly 600′000 files.
If you have an external disk, I would recommand to adapt the below procedure to download the ISO image on an external physical disk (writes faster than on a laptop), mount it, and then do the rsync between your external disk (read faster than on a laptop) and your internal disk. ⁞
cd /export
pfexec wget http://mirror.switch.ch/ftp/mirror/opensolaris.org/release_isos/2009/06/osol-repo-0906-full.iso
pfexec mount -F hsfs `pfexec lofiadm -a /export/osol-repo-0906-full.iso` /mnt
pfexec zfs create -o compression=on /rpool/repo pfexec rsync -aP /mnt/repo /rpool/repo
Now that we have all the package files of the repository correctly and permanently mounted, let manage the package server service.
You need to add you hostname in two locations:
* add your hostname at the origins line in the /rpool/repo/cfg_cache file
* add you hostname and IP address in the /etc/inet/hosts file.
Be aware that this last file is read-only, so force writing throught vi of change permissions before editing it.
svccfg -s application/pkg/server setprop pkg/inst_root=/rpool/repo
svccfg -s application/pkg/server setprop pkg/readonly=true
svccfg -s application/pkg/server setprop pkg/cfg_file=/rpool/repo/cfg_cache
svcadm refresh application/pkg/server
svcadm enable application/pkg/server
You package server should then be up and running on the default port 1000.
You can then open your browser on http://localhost:10000 and see your new IPS server online
If you want to use it, you can use it as the default pkg server with the "pkg set-publisher -O" command, or as a mirror pkg server with the "pkg set-publisher -m" command.
You can also use the GUI (package manager) to do that.
More details can be found here or through a single "man pkg" command.
Source/Kaynak : http://blogs.sun.com/karim/entry/build_your_own_repository