Sun Microsystems 10 User Manual

Page of 121
Version 3.1-en
  Solaris 10 Container Guide - 3.1   5. Cookbooks 
Effective: 30/11/2009
5.1.13. Configuring a zone by command file or template
[dd] Zones can be configured by using command files for zonecfg or by the use of templates. This 
allows quick and automatic configuration of many zones avoiding errors.
Using the zonecfg command file
A command file is set up for automatic configuration of the zone.
1. Create zonecfg command file
- with zonecfg -z <zone> export -f <file> of an existing zone
- alternatively: create the zone config file with a text editor, one command per line
2. Use the command file to configure a new zone
zonecfg -z <zone> -f <file>
Using templates
A new zone is configured by using an already configured zone. Any necessary configuration 
changes are done after that
 zonecfg -z <zone> create -t <template-zone>
5.1.14. Automatic quick installation of zones
[ug] The installation of zones takes just a few to several minutes, depending on the speed of the file 
system (disks) and the zone software to be copied. This can be reduced considerably if many zones 
are to be created that are identical with respect to their configuration (essential criteria for this are the 
inherit-pkg-dir settings).
Preparation:
1. zonecfg of a template zone with the desired configuration,
which must not be used later on (for example with the name template1).
In so doing, zonepath must be set, the configuration of the network address should be 
absent because the zone merely serves as a template after all and is not to become 
operational.
2. Install the zone template1 with zoneadm.
3. Save the contents of the zone  template1 in a tar file template1.tar .
(Note: cp -r is not suitable for copying zones!)
Creation of duplicated zones:
1. Configure with zonecfg using the template function
(create -t template1).
(The  inherit-pkg-dir settings must not be changed!)
2. Change zonepath with zonecfg (can be done by script)
3. Enter the network address(es) with zonecfg.
4. Unpack template1.tar below zonepath of the new zone.
5. <zone> attach 
6. Boot the new zone for operation.
Since the template zone cannot be started up directly, the following procedure is required to install 
patches:
1. Configure the zone template1 (manually or with sysidcfg file)
2. Install the patches (it is best to have all configured zones booted up)
3. De-configure the zone template1 with the command
zlogin template1 sys-unconfig 
4. Re-create the zone content file template1.tar .
Alternatively,   the   command  zoneadm   -z   template1   clone  can   be   used   instead   of   a 
manual copy.
79