Isolating Your Development Work

Setting Up Your Development Environment on OpenSolaris

Isolating Your Development Work Using Zones

You might want to develop and test different applications in different zones in the OpenSolaris OS. Applications running in different zones do not interact and do not directly compete for resources.

Using zones is also a good way to deploy applications that need to stay separate.

A zone is a virtualized operating system environment within a single instance of the Solaris 10 OS or OpenSolaris OS. A zone is an application execution environment in which processes are isolated from the rest of the system. Processes that are running in one zone cannot monitor or affect processes running in other zones. Even a process running with superuser credentials cannot view or affect activity in other zones.

Every Solaris system contains a global zone. The global zone is both the default zone for the system and the zone used for system-wide administrative control. Only the global zone is bootable from the system hardware.

In this discussion, the term zone means non-global zone. Non-global zones must be configured, installed, managed, and uninstalled from the global zone.

Each zone is assigned a zone name. Each zone also has a node name that is independent of the zone name. The node name is assigned by the administrator of the zone.

Each zone is given a unique numeric identifier, which is assigned by the system when the zone is booted. Each zone has a path to its root directory that is relative to the global zone's root directory.

Other resources and properties are optional. A shared-IP zone is the easiest to create if you need network connectivity. The shared-IP zone is the default type.

Creating a Zone: Steps

Take the following steps to create a zone:

  1. Use the zonecfg(1M) command to configure a zone. Specify various parameters for the zone's virtual platform and application environment. You must specify a name and path for the zone.
  2. Use the zoneadm(1M) command to install the configured zone. Install software at the package level into the file system hierarchy established for the zone.
    • If you plan to use an /etc/sysidcfg file to perform initial zone configuration, create the sysidcfg file and place it the zone's /etc directory before you boot the zone.
  3. Use the zoneadm command to boot the zone.
  4. Use the zlogin(1) command to log in to the zone console to perform the internal zone configuration. Use the zlogin command with the -C option and enter the requested information, including assigning the zone root password.

Creating a Zone: Examples

Following is a very simple example that shows minimal configure, install, boot, and log in:

global$ zoneadm list -cv
  ID NAME        STATUS     PATH          BRAND    IP
   0 global      running    /             native   shared
global$ pfexec zonecfg -z myzone
myzone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:myzone> create
zonecfg:myzone> set zonepath=/export/home/myzone
zonecfg:myzone> verify
zonecfg:myzone> commit
zonecfg:myzone> exit
global$ zoneadm list -cv
  ID NAME        STATUS     PATH                  BRAND    IP
   0 global      running    /                     native   shared
   - myzone      configured /export/home/myzone   ipkg     shared
global$ pfexec zoneadm -z myzone install
A ZFS file system has been created for this zone.
   Publisher: Using release (http://pkg.opensolaris.org/release/).
 done.                       /export/home/myzone/root ...Refreshing Catalog
       Cache: Using /var/pkg/download.
Sanity Check: Looking for 'entire' incorporation.
  Installing: Core System (output follows)
<...more messages...>
        Done: Installation completed in 351.567 seconds.
  Next Steps: Boot the zone, then log into the zone console
             (zlogin -C) to complete the configuration process
global$ pfexec zoneadm -z myzone boot
global$ pfexec zlogin -C myzone
<Answer questions about terminal type, host name, time zone, root password.>
<Log in. To log out, enter the tilde character followed by the period: ~.>
global$ zoneadm list -cv
  ID NAME        STATUS     PATH                  BRAND    IP
   0 global      running    /                     native   shared
   1 myzone      running    /export/home/myzone   ipkg     shared
global$ pfexec zlogin myzone
myzone# exit
global$

Create user accounts, install additional software, and customize the zone's configuration. Add zone-wide resource controls and pool functionality to a zone quickly by using zonecfg properties. You can partition resources, constrain resources, and allocate resources based on the importance of the zone. A zone that includes resource management features is called a container.

How to Configure the Zone is an example that shows many zone configuration actions such as restricting and allocating resources, modifying privileges, adding a file system, adding a ZFS dataset, adding a shared file system that is loopback-mounted from the global zone, adding a network interface, adding a device.

Zone Installs also shows more complex, real world examples.

Zones Information Resources

For more information, see the following resources:

Labels

appdeveloper appdeveloper Delete
task task Delete
configuring configuring Delete
developing developing Delete
installing installing Delete
zones zones Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact