Build your own OpenSolaris 2009.06 IPS repository on your laptop
By Karim Berrah on Sep 10, 2009
why ? 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. It's also speeding up the process of installing a zone, while this action requires downloading packages from a repository.
A big thank you to Brian Leonard who wrote the first a good example of the man page of pkg.depotd (1m). I have been inspired by his blog. So, I just added a few lines, and removed the details given by Brian. So, if you need more details on the commands, just go the Brian's blog (previous link).
So, this procedure works well from a fresh OpenSolaris 2009.06 installation (build 111b).
Be aware that step 1 below can be quite time consuming: 7GB of download (here from a website in Switzerland), and then 40 minutes are needed to copy approximatly 600'000 files from the mounted iso image into a directory, which is a long disk to (same laptop) disk operation.
If you have an external disk, I would recommand to adapt the below procedure to download the ISO image on an external physical disk, mount it, and then do the rsync between your external disk (read operations are faster than on a laptop disk) and your internal disk. You'll then only do read operations on the external disk, and write operations on your internal disk, then reducing per 50% the number of I/O on you slower internal disk. And you can loand your external disk to someone else if he would like to have his own mirror too :)
Step 1: Get the full ISO image repository
As I'm living in Switzerland, I would like to get it from a local mirror site, here switch.
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/repo111
pfexec rsync -aP /mnt/repo /rpool/repo111
pfexec lofiadm -d /dev/lofi/1
Now that we have all the package files of the repository correctly and permanently mounted on the laptop, let manage the package server service, called application/pkg/server.
Step 2: Configure the package server
Before setting up the service and starting it, you have to add your hostname in two locations:
\* add your hostname at the origins line in the /rpool/repo111/repo/cfg_cache file
\* add your hostname and IP address in the /etc/inet/hosts file.
Be aware that hosts file is read-only, so just force writing through vi (using a wq! command) of adapt write permissions (chmod) before editing it.
svccfg -s application/pkg/server setprop pkg/inst_root=/rpool/repo111/repo
svccfg -s application/pkg/server setprop pkg/readonly=true
svccfg -s application/pkg/server setprop pkg/cfg_file=/rpool/repo111/repo/cfg_cache
svcadm refresh application/pkg/server
svcadm enable application/pkg/server
Step 3: Check your new IPS server
Your package server should then be up and running on the default port 80.
You can then open your browser on http://localhost and see your new IPS server online
If you already have installed a web server on port 80, you can change the IPS server port number in the /rpool/repo111/repo/cfg_cache file.
Step 4: use/share your own IPS server
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.depotd" command.
So now, you can:
- check, download and test packages even when your are off-line
- install zones in a faster way without having to be connected to Internet
- provide a packages servers manually to networks zone that have restricted access to Internet (labs) by just moving your laptop there.
- use it to demo live how IPS works when you don't have internet connectivity
- use to serve your private OpenSolaris VBox VMs when you have many AMP stack to deploy (SugarCRM or Drupal to install on many VMs)
- you'll certainly find other good reasons to use it ;)