« sudo? | Main | Left Behind »

File Based Repo

It was always possible to mount an ISO and use it as the package repository, but you also had to configure and run a local package server. With Solaris 11 Express, it is now possible to serve the packages directly from the local repository files, bypassing the server.

Step 1: Download the Repository Image

The repository image comes in two 2 GB chunks and they're available on the Solaris 11 Express Downloads page. After downloading parts A & B, unzip and concatenate them as follows:

bleonard@solaris:~$ cd Download/
bleonard@solaris:~/Download$ unzip sol-11-exp-201011-repo-full-iso-a.zip 
Archive:  sol-11-exp-201011-repo-full-iso-a.zip
  inflating: sol-11-exp-201011-repo-full.iso-a  
bleonard@solaris:~/Download$ unzip sol-11-exp-201011-repo-full-iso-b.zip 
Archive:  sol-11-exp-201011-repo-full-iso-b.zip
  inflating: sol-11-exp-201011-repo-full.iso-b  
bleonard@solaris:~/Download$ cat sol-11-exp-201011-repo-full.iso-a sol-11-exp-201011-repo-full.iso-b > sol-repo-full.iso

Note, I kept the ISO name generic, as this allows me to upgrade to a newer version of the repository by simply replacing the underlying ISO.

Step 2: Mount the Repository Image

Create a directory at which to mount the ISO:

 bleonard@solaris:~$ sudo mkdir /repo

Mount the ISO to the /repo directory:

bleonard@solaris:~$ sudo mount -F hsfs ~/Download/sol-repo-full.iso /repo

Step 3: Make the Mount Persistent

The mount will not survive a reboot. You have a couple of approaches to make it persist:

The Quick and Dirty Way

Add the following file to /etc/rc3.d:

# cat /etc/rc3.d/S99mountiso
#!/bin/sh
#
mount -F hsfs /export/home/bleonard/Download/sol-repo-full.iso /repo 

The SMF Way

Save the following repo.xml SMF manifest to /var/svc/manifest/system/filesystem, which defines a new service, repo.

Install the repo service:

bleonard@opensolaris:~$ svccfg import /var/svc/manifest/system/filesystem/repo.xml

Start the repo service:

bleonard@opensolaris:~$ svcadm enable repo 
bleonard@opensolaris:~$ svcs -l repo
fmri         svc:/system/filesystem/repo:default
name         Solaris ISO repository mounter
enabled      true
state        online
next_state   none
state_time   Mon Oct 11 09:40:07 2010
logfile      /var/svc/log/system-filesystem-repo:default.log
restarter    svc:/system/svc/restarter:default
dependency   require_all/none svc:/system/filesystem/local (online)

Step 4: Add the Local Repository as a Publisher

This is the new part in that a publisher can now point to a local file, bypassing the need to set up a local package server.

You can either set up the local file as a mirror or on its own. Use the following syntax to set it up as a mirror:

bleonard@solaris:~$ sudo pkg set-publisher -m file:///repo/repo/ -P solaris
bleonard@solaris:~$ pkg publisher
PUBLISHER                             TYPE     STATUS   URI
solaris                  (preferred)  origin   online   http://pkg.oracle.com/solaris/release/
solaris                  (preferred)  mirror   online   file:///repo/repo/

To remove the mirror:

bleonard@solaris:~$ sudo pkg set-publisher -M file:///repo/repo/ solaris

To set it up on its own:

bleonard@solaris:~$ sudo pkg set-publisher -G http://pkg.oracle.com/solaris/release -g file:///repo/repo/ -P solaris
bleonard@solaris:~$ pkg publisher
PUBLISHER                             TYPE     STATUS   URI
solaris                  (preferred)  origin   online   file:///repo/repo/

In the above we're removing the default remote repository and replacing it with the new local repository. You can see the status of the repository as follows:

bleonard@solaris:~$ pkgrepo info -s /repo/repo
PUBLISHER PACKAGES STATUS           UPDATED
solaris   3941     online           2010-11-11T00:04:39.171739Z

At this point, the repository is ready for use.

However, one minor limitation is that the repository doesn't include a search index (this was done to reduce the initial size of the repository):

bleonard@solaris:~$ pkg search hex
pkg: Some repositories failed to respond appropriately:
solaris:
file protocol error: code: 11 reason: Search temporarily unavailable.
Repository URL: 'file:///repo/repo'. (happened 4 times)

And since the ISO is mounted directly (and therefore, read-only), one can't be built. If you happen to extract the ISO, a search index could be build with the following command:

sudo pkgrepo -s /repo/repo refresh

Conclusion

I like this approach because when a new repository becomes available, I simply need to replace the ISO file and I'm all set. For further details, including how to set up a local repository server, see the article How To Copy an Oracle Solaris 11 Express Software Package Repository.

« sudo? | Main | Left Behind »
Comments:

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