Solaris | Thursday, March 16, 2017

Setting up a Solaris Repository & SRU Updates...

Solaris packaging system (aka IPS) is great, flexible and available on-line, so if you have your support license you're entitled to download all the updates from the official source. However, if you've got to manage a number of machines in your organization, it could be better to have a local SW source to manage the installation/distribution/update your systems (both SPARC and x86) [tired of jumping across the various documents to get it working, I'm writing a note for myself]

Current official product documentation is covered in the Copying and Creating Package Repositories in Oracle Solaris 11.3 which I strongly suggest as a reading ;-)

First of all, you need to download from the Oracle website the full, initial Oracle Solaris 11.3 Repository (you'll need all the ZIPs, the MD5s and the ksh script). After that, if you have a valid support contract, you could download from My Oracle Support, consulting the Oracle Solaris 11.3 Support Repository Updates (SRU) Index (Doc ID 2045311.1) [at the time of writing, the latest available SRU is 17.5].

I've placed the payloads of the two repositories each in a dedicated directory, sitting on separate datasets:

# zfs create -o compression=lz4 -o recordsize=1M -o mountpoint=/Shared/S11.3_GA rpool/S11.3_GA
# zfs create -o compression=lz4 -o recordsize=1M -o mountpoint=/Shared/S11.3_SRU_17.5 rpool/S11.3_SRU_17.5

# ls -l /Shared/S11.3_GA /Shared/S11.3_SRU_17.5:
total 16477177
-rwxr-xr-x   1 root     root       11612 Mar 15 15:20 install-repo.ksh
-rw-r--r--   1 root     root     1540097274 Oct 13  2015 sol-11_3-repo_1of5.zip
-rw-r--r--   1 root     root     1730669364 Oct 13  2015 sol-11_3-repo_2of5.zip
-rw-r--r--   1 root     root     1717187368 Oct 13  2015 sol-11_3-repo_3of5.zip
-rw-r--r--   1 root     root     1871913207 Oct 13  2015 sol-11_3-repo_4of5.zip
-rw-r--r--   1 root     root     1570373423 Oct 13  2015 sol-11_3-repo_5of5.zip
-rw-r--r--   1 root     root         285 Mar 15 15:20 sol-11_3-repo_md5sums.txt

/Shared/S11.3_SRU_17.5/:
total 11647668
-rwxr-xr-x   1 root     root       12262 Feb 17 20:54 install-repo.ksh
-rw-r--r--   1 root     root     1397316994 Mar 10 19:07 p25485757_1100_SOLARIS64_1of4.zip
-rw-r--r--   1 root     root     1589454947 Mar 10 19:11 p25485757_1100_SOLARIS64_2of4.zip
-rw-r--r--   1 root     root     1452681550 Mar 10 19:14 p25485757_1100_SOLARIS64_3of4.zip
-rw-r--r--   1 root     root     1519777998 Mar 10 19:17 p25485757_1100_SOLARIS64_4of4.zip
-rw-r--r--   1 root     root       66103 Mar 10 19:17 p25485763_1100_SOLARIS64.zip
-rw-r--r--   1 root     root        4199 Feb 17 20:54 README-zipped-repo.txt
-rw-r--r--   1 root     root         444 Feb 17 21:10 sol-11_3_17_5_0-incr-repo_digest.txt

At this point we can start 'inflating' the initial Solaris 11.3_GA repository in the location that will be the base of our IPS publishing system (I generally prefer to keep that on a separate dataset with specific options):

# zfs create -o compression=lz4 -o dedup=on -o recordsize=1M -o mountpoint=/export/s11repo zones/S11.3_REPO
# cd /Shared/S11.3_GA
# time ./install-repo.ksh -d /export/s11repo
Using sol-11_3-repo download.
Uncompressing sol-11_3-repo_1of5.zip...done.
Uncompressing sol-11_3-repo_2of5.zip...done.
Uncompressing sol-11_3-repo_3of5.zip...done.
Uncompressing sol-11_3-repo_4of5.zip...done.
Uncompressing sol-11_3-repo_5of5.zip...done.
Repository can be found in /export/s11repo.

real    3m0.407s
user    1m25.826s
sys     1m20.932s


Which after all, it's not too bad for an 'old' x4150 system ;-) Let's check 'how well' the ZFS helped with the compression and saving:

# zfs get compressratio,used zones/S11.3_REPO
NAME              PROPERTY       VALUE  SOURCE
zones/S11.3_REPO  compressratio  1.19x  -
zones/S11.3_REPO  used           8.46G  -


Of course, there won't be any benefit from the 'dedup' ratio, due to the fact that we're still using a single dataset:

# zpool get dedupratio zones
NAME   PROPERTY    VALUE  SOURCE
zones  dedupratio  1.00x  -


Using the IPS tools we can check the version of the repository that we just inflated, using the pkgrepo command to query it:

# pkgrepo -s /export/s11repo list entire
PUBLISHER NAME                  O VERSION
solaris   entire                  0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z

Which is the original Solaris 11.3 General Availability (the timestamp says Oct, 6th 2015).

On Solaris 11.3, there is a dedicated service to control a local IPS system:

# svcs -xv svc:/application/pkg/server
svc:/application/pkg/server:default (image packaging repository)
 State: disabled since March 22, 2017 02:56:49 AM CET
Reason: Disabled by an administrator.
   See: http://support.oracle.com/msg/SMF-8000-05
   See: /var/svc/log/application-pkg-server:default.log
Impact: This service is not running.


This SMF service, has a property (pkg/inst_root) which controls the full path to the IPS that shall be published; in our case, we need to set to the path where we just inflated the GA repository:

# svccfg -s svc:/application/pkg/server setprop pkg/inst_root=/export/s11repo
# svcadm refresh svc:/application/pkg/server


Now we can start the service:

# svcadm enable svc:/application/pkg/server
# svcs -xv svc:/application/pkg/server
svc:/application/pkg/server:default (image packaging repository)
 State: online since March 22, 2017 03:13:04 AM CET
   See: /var/svc/log/application-pkg-server:default.log
Impact: None.


And verify that also the published repository is correctly up and running, available as an HTTP service:

# pkgrepo -s http://<MY_IP_ADDRESS> list entire
PUBLISHER NAME                  O VERSION
solaris   entire                  0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z


Now have a full, valid IPS repository that could be used either to distribute packages and updates in our network, but it also could be used to deploy Solaris Zones and AI (Automated Installer) clients.

Before moving forward and applying the latest SRU to the freshly published Solaris 11.3 GA repository, we just want to be sure to have the chance to quickly revert to a 'previous version' of the repository in case we need it. Therefore we could levarage the ZFS capabilities and take a snapshot of the current dataset:

# svcadm disable svc:/application/pkg/server
# zfs list zones/S11.3_REPO
NAME               USED  AVAIL  REFER  MOUNTPOINT
zones/S11.3_REPO  8.46G   620G  8.46G  /export/s11repo
# zfs snapshot zones/S11.3_REPO@GA
# zfs list -rt all zones/S11.3_REPO
NAME                  USED  AVAIL  REFER  MOUNTPOINT
zones/S11.3_REPO     8.46G   620G  8.46G  /export/s11repo
zones/S11.3_REPO@GA      0      -  8.46G  -
# svcadm enable svc:/application/pkg/server


Once we have a snapshot of the 'GA' repository, we could upgrade the IPS repository to the latest available SRU, on a different filesystem to avoid interruptions of the IPS service (official instructions available here). To do that, we of course need to create a clone of the filesystem with the GA repository, from the snapshot:

# zfs clone zones/S11.3_REPO@GA zones/S11.3_REPO_SRU_17.5

A simple clone of the snapshot, might not inherit all the properties:

# zfs get compression,dedup,mountpoint,recordsize zones/S11.3_REPO_SRU_17.5
NAME                  PROPERTY     VALUE  SOURCE
zones/S11.3_REPO_SRU_17.5  compression  off    default
zones/S11.3_REPO_SRU_17.5  dedup        off    default
zones/S11.3_REPO_SRU_17.5  mountpoint   none   inherited from zones
zones/S11.3_REPO_SRU_17.5  recordsize   128K   default


Therefore, we'll have to set them manually:

# zfs set compression=lz4 zones/S11.3_REPO_SRU_17.5
# zfs set recordsize=1M zones/S11.3_REPO_SRU_17.5
# zfs set dedup=on zones/S11.3_REPO_SRU_17.5
# zfs set mountpoint=/export/s11REPO_SRU_17.5 zones/S11.3_REPO_SRU_17.5


and check again:

# zfs get compression,dedup,mountpoint,recordsize zones/S11.3_REPO_SRU_17.5
NAME                  PROPERTY     VALUE                SOURCE
zones/S11.3_REPO_SRU_17.5  compression  lz4                  local
zones/S11.3_REPO_SRU_17.5  dedup        on                   local
zones/S11.3_REPO_SRU_17.5  mountpoint   /export/s11REPO_SRU_17.5  local
zones/S11.3_REPO_SRU_17.5  recordsize   1M                   local


Now let's finally verify the datasets:

# zfs list -rt all zones/S11.3_REPO zones/S11.3_REPO_SRU_17.5
NAME                   USED  AVAIL  REFER  MOUNTPOINT
zones/S11.3_REPO      8.46G   620G  8.46G  /export/s11repo
zones/S11.3_REPO@GA       0      -  8.46G  -
zones/S11.3_REPO_SRU_17.5  1.66K   620G  8.46G  /export/s11REPO_SRU_17.5


At this point the two directory structures are completely identical:

# ls -l /export/s11repo /export/s11REPO_SRU_17.5/
/export/s11repo:
total 30
-rw-r--r--   1 root     root        3440 Oct  6  2015 COPYRIGHT
-rw-r--r--   1 root     root        1626 Oct  6  2015 NOTICES
-rw-r--r--   1 root     root         329 Oct  6  2015 pkg5.repository
drwxr-xr-x   3 root     root           3 Mar 21 23:29 publisher
-rwxr-xr-x   1 root     root        5970 Oct  6  2015 README-repo-iso.txt
-rw-r--r--   1 root     root         573 Oct  6  2015 readme.txt

/export/s11REPO_SRU_17.5/:
total 30
-rw-r--r--   1 root     root        3440 Oct  6  2015 COPYRIGHT
-rw-r--r--   1 root     root        1626 Oct  6  2015 NOTICES
-rw-r--r--   1 root     root         329 Oct  6  2015 pkg5.repository
drwxr-xr-x   3 root     root           3 Mar 21 23:29 publisher
-rwxr-xr-x   1 root     root        5970 Oct  6  2015 README-repo-iso.txt
-rw-r--r--   1 root     root         573 Oct  6  2015 readme.txt

And so are the repositories therein contained:

# pkgrepo -s /export/s11repo list entire
PUBLISHER NAME                  O VERSION
solaris   entire                  0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z
# pkgrepo -s /export/s11REPO_SRU_17.5 list entire
PUBLISHER NAME                  O VERSION
solaris   entire                  0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z


Now we can move forward and update the repository on the second dataset, using the already downloaded ZIP SRU:

# cd /Shared/S11.3_SRU_17.5/
# ls -l
total 11614396
-rwxr-xr-x   1 root     root       12262 Feb 17 20:54 install-repo.ksh
-rw-r--r--   1 root     root     1397316994 Mar 10 19:07 p25485757_1100_SOLARIS64_1of4.zip
-rw-r--r--   1 root     root     1589454947 Mar 10 19:11 p25485757_1100_SOLARIS64_2of4.zip
-rw-r--r--   1 root     root     1452681550 Mar 10 19:14 p25485757_1100_SOLARIS64_3of4.zip
-rw-r--r--   1 root     root     1519777998 Mar 10 19:17 p25485757_1100_SOLARIS64_4of4.zip
-rw-r--r--   1 root     root       66103 Mar 10 19:17 p25485763_1100_SOLARIS64.zip
-rw-r--r--   1 root     root        4199 Feb 17 20:54 README-zipped-repo.txt
-rw-r--r--   1 root     root         444 Feb 17 21:10 sol-11_3_17_5_0-incr-repo_digest.txt

We can start applying the latest SRU on top of the original S11.3_GA repository. Please be aware that using the -v command option (not used in the following example) will force a verification of the package, which might take some time...

# time ./install-repo.ksh -d /export/s11REPO_SRU_17.5 -y
Using p25485757_1100_SOLARIS64 files for sol-11_3_17_5_0-incr-repo download.
IPS repository exists at destination /export/s11REPO_SRU_17.5
Current version: 0.175.3.1.0.5.0
Adding packages to existing repository.
Uncompressing p25485757_1100_SOLARIS64_1of4.zip...done.
Uncompressing p25485757_1100_SOLARIS64_2of4.zip...done.
Uncompressing p25485757_1100_SOLARIS64_3of4.zip...done.
Uncompressing p25485757_1100_SOLARIS64_4of4.zip...done.
Repository can be found in /export/s11REPO_SRU_17.5.
Initiating repository rebuild.

real    9m10.648s
user    6m46.571s
sys     0m56.113s


Now, the second location contains both repositories:

# pkgrepo -s /export/s11repo list entire
PUBLISHER NAME                  O VERSION
solaris   entire                  0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z
# pkgrepo -s /export/s11REPO_SRU_17.5 list entire
PUBLISHER NAME                  O VERSION
solaris   entire                  0.5.11,5.11-0.175.3.17.0.5.0:20170217T020457Z
solaris   entire                  0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z

The extracted repository is valid, and contains the latest SRU (timestamp is Feb, 17th 2017). The filesystem occupation is:

# zfs list -rt all zones/S11.3_REPO zones/S11.3_REPO_SRU_17.5
NAME                   USED  AVAIL  REFER  MOUNTPOINT
zones/S11.3_REPO      8.46G   614G  8.46G  /export/s11repo
zones/S11.3_REPO@GA       0      -  8.46G  -
zones/S11.3_REPO_SRU_17.5  6.20G   614G  13.7G  /export/s11REPO_SRU_17.5

# zfs get compressratio,used zones/S11.3_REPO zones/S11.3_REPO_SRU_17.5
NAME                  PROPERTY       VALUE  SOURCE
zones/S11.3_REPO      compressratio  1.19x  -
zones/S11.3_REPO      used           8.46G  -
zones/S11.3_REPO_SRU_17.5  compressratio  1.19x  -
zones/S11.3_REPO_SRU_17.5  used           6.20G  -

# zpool get dedupratio zones
NAME   PROPERTY    VALUE  SOURCE
zones  dedupratio  1.04x  -

As last step, we need to publish the latest updates in the online repository; to do that we'll shut down the current SMF service:

# svcadm disable svc:/application/pkg/server
# svccfg -s svc:/application/pkg/server listprop pkg/inst_root
pkg/inst_root astring     /export/s11repo

Verify once again the mountpoint an the compression rates:

# zfs get mountpoint,compressratio,used zones/S11.3_REPO zones/S11.3_REPO_SRU_17.5
NAME                  PROPERTY       VALUE                SOURCE
zones/S11.3_REPO      mountpoint     /export/s11repo      local
zones/S11.3_REPO      compressratio  1.19x                -
zones/S11.3_REPO      used           8.46G                -
zones/S11.3_REPO_SRU_17.5  mountpoint     /export/s11REPO_SRU_17.5  local
zones/S11.3_REPO_SRU_17.5  compressratio  1.19x                -
zones/S11.3_REPO_SRU_17.5  used           6.20G                -

Umount the old repository:

# zfs set mountpoint=legacy zones/S11.3_REPO

Mount the dataset with new repositories at the same location:

# zfs set mountpoint=/export/s11repo zones/S11.3_REPO_SRU_17.5
# zfs get mountpoint zones/S11.3_REPO zones/S11.3_REPO_SRU_17.5
NAME                  PROPERTY    VALUE            SOURCE
zones/S11.3_REPO      mountpoint  legacy           local
zones/S11.3_REPO_SRU_17.5  mountpoint  /export/s11repo  local

Verify again the repositories at filesystem level:

# pkgrepo -s /export/s11repo list entire
PUBLISHER NAME                  O VERSION
solaris   entire                  0.5.11,5.11-0.175.3.17.0.5.0:20170217T020457Z
solaris   entire                  0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z

Enable the SMF service:

# svcadm enable svc:/application/pkg/server
# svcs -xv svc:/application/pkg/server
svc:/application/pkg/server:default (image packaging repository)
 State: online since March 22, 2017 05:03:24 AM CET
   See: /var/svc/log/application-pkg-server:default.log
Impact: None.


Check the on-line version of the new repostitory:

# pkgrepo -s http://
<MY_IP_ADDRESS> list entire
PUBLISHER NAME                  O VERSION
solaris   entire                  0.5.11,5.11-0.175.3.17.0.5.0:20170217T020457Z
solaris   entire                  0.5.11,5.11-0.175.3.1.0.5.0:20151006T140051Z

Have fun!

Join the discussion

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
 

Visit the Oracle Blog

 

Contact Us

Oracle

Integrated Cloud Applications & Platform Services