Sun Microsystems 10 用户手册

下载
页码 121
Version 3.1-en
  Solaris 10 Container Guide - 3.1   4. Best Practices 
Effective: 30/11/2009
4.3. Configuration and administration
4.3.1. Manual configuration of zones with zonecfg
[ug] The command zonecfg is used to configure a zone; see the example in the Cookbook.
The configuration merely describes the directory (zonecfg: zonepath) in which the files for the 
zone are to be placed and how system directories of a local zone are created from the directory 
contents from the global zone (copy/loopback mount). Additional options are configuration of network 
addresses, file systems, devices, etc. 
Each zone, once configured, can also be used as a template for additional zones. This cloning of 
configurations considerably simplifies the creation of zones that have similar configurations.
We   advise   against   configuring   zones   by   editing   the   XML-files   under  /etc/zones  since   this 
procedure is very error-prone and is therefore not supported.
4.3.2. Manual installation of zones with zoneadm
[ug] Once a zone has been configured, the next step consists of its installation with zoneadm   -z 
<zone> install
 (see Cookbook). In the process, all packages (Solaris pkg) that do not belong 
to the Solaris kernel are installed into the zone, while the files that are available from the global zone 
via loopback mount are not copied. During this process, the post-install scripts of the packages for the 
zone   are   also   executed.   In   the   end,   the   zone   has   its   own   package   database 
(/var/sadm/install/*). The packages of the global zone are used as the source for the 
packages to be installed on the local zone.
After this , the zone can be booted.
4.3.3. Manual uninstallation of zones with zoneadm
[ug] If a zone is not needed anymore, it can be uninstalled with 
zoneadm -z <zone> uninstall . This will remove all files in the zone path, even those that 
were created after installation.
The configuration of the zone will remain.
4.3.4. Manual removal of a configured zone with zonecfg
[ug] To remove a zone, uninstallation should be performed first. Next, the configuration of the zone 
can be removed with the command zoneadm -z zone destroy.
4.3.5. Duplication of an installed zone
[ug] Zones can be duplicated rapidly if the inherit-pkg-dir configurations are identical. Then, 
a zone can be created as a template and quickly duplicated for each zone by copying the contents.
Since Solaris 10 11/06, this can be done with the command zoneadm   clone   . Additionally to 
copying the directories some tests are performed.
Starting with Solaris 10 5/09 the cloning for a zone on ZFS, the clone functionality of ZFS is used 
automatically, which considerably accelerates zone duplication.
 or 
).
4.3.6. Standardized creation of zones
[ug] Zones can be created in the following manner:
with the command 
z o n e c f g
 and then with 
z o n e a d m
 to install the zone
with the container manager in the Sun Management Center (SunMC)
with Webmin, a free management tool included with Solaris 10/OpenSolaris (Solaris zones 
module: latest version zones.wbm.gz downloadable at 
http://www.webmin.com/standard.html
)
by scripts that call 
z o n e c f g
 and 
z o n e a d m
 
The container manager and Webmin are suitable for admins that rarely set up zones.
With 
z o n e c f g
, zones can be created according to site standards by setting up zones as templates. 
A zone can then be used as a template with the 
z o n e c f g
 subcommand
c r e a t e   - t   < t e m p l a t e >
 . 
50