How to Create and Deploy a Non-Global Zone

If you plan to install other packages in addition to the default solaris-small-server package, make sure that you have properly prepared the manifest. Also, if you want to automate the system configuration of the zone, make sure that you have created and prepared the configuration profile. See Using Manifests and Configuration Profiles.

Unless specified otherwise, all the procedures in this guide assume that you are not working directly on the server system that hosts the zones. Rather, you are remotely connected to the system through a secure shell session.

  1. Become a zone administrator.
  2. Create the zone.

    Choose from one of the following options.

    • Create the zone with no additional options.

      global$ zonecfg -z zonename create [-t template]

      Specify the ‐t template option if you want a different brand from solaris.

    • Create the zone and configure some zone properties.

      1. Switch to the interactive configuration method and create the zone.

        global$ zonecfg -z zonename 
        Use 'create' to begin configuring a new zone.
        zonecfg:zonename> create
        create: Using system default template SYSdefault
        zonename>
      2. Configure zone properties.

        As an example for this step, set the autoboot, description, and physical properties. physical is a property of the net resource. description is a global property.

        zonecfg:zonename> set autoboot=true
        zonecfg:zonename> set description="zone description"
        zonecfg:zonename> add net
        zonecfg:zonename:net> set physical=net1
        zonecfg:zonename:net> end
        zonecfg:zonename> exit
        global$

        Note:

        If you want a different brand from solaris, you must also type set brand= brand before exiting interactive configuration mode.
  3. From the global zone, install the non-global zone.
    global$ zoneadm -z zonename install \
    [-m full-path-to manifest.xml] [-c full-path-to-profile.xml]

    Specify the ‐m option if you are using a manifest or the ‐c option if you are using a configuration profile.

  4. bootingzoneszoneadm boot commandBoot the zone.
    global$ zoneadm -z zonename boot [-- -m verbose]

    Use the -m verbose option to obtain more information than the standard command output. For other options of the boot command, see the zoneadm(8) man page.

    If you used a configuration profile during the installation, skip the next and final step.

  5. If you did not use a configuration profile in Step 3, manually perform the zone's system configuration.
    1. Open a separate terminal window.
    2. Log in to the zone console.

      global$ zlogin -C zonename
      [Connected to zone zonename console]
    3. Press Enter.

      The SCI tool opens.

    4. On each of the SCI tool's screens, provide the information as prompted.

      For the computer name, you can optionally assign a different name than the zone name.

      When you exit the SCI tool, the login prompt is displayed.

      zone-hostname login:
    5. Log in by using the credentials that you specified in the SCI tool.

      After logging in, the prompt would be similar to the following:

      username@zone-hostname:-$
    6. Log out of the zone.

      username@zone-hostname:-$ exit
      zone-hostname login:
    7. Disconnect the console by using the tilde-dot characters.
      zone-hostname login: ~.
      zone-hostname login: Connection to host-system closed.

Example 2-1 Creating a Non-Global Zone With a System Configuration Profile

This example shows how a zone named zoneA is created based on the following assumptions:

  • The zone uses the default solaris brand.

  • The properties zonepath and autoboot are set.

  • The physical property of the net resource is set.

  • For its root file system, zoneA will use rpool/zones/, whose mountpoint is /zones.

  • A profile is used to automate the zone's system configuration.

  • Only the default package is installed, and therefore, no special manifest is created.

  • All necessary rights, both zone related and non-zone related, have been granted.

global$ pfbash
                        Create the profile. Provide information in the SCI tool.
global$ sysconfig create-profile -o /var/tmp
                        Create the zone and set zone properties.
global$ zonecfg -z zoneA 
Use ‘create’ to begin configuring a new zone.
zonecfg:zoneA> create
create: Using system default template ‘SYSdefault’
zonecfg:zoneA> set autoboot=true
zonecfg:zoneA> set zonepath=/zones/zoneA
zonecfg:zoneA> add net
zonecfg:zoneA:net> set physical=net1
zonecfg:zoneA:net> end
zonecfg:zoneA> exit
global$

Install the zone.
global$ zoneadm -z zoneA install -c /var/tmp/sc_profile.xml
                        Boot the zone.
global$ zoneadm -z zoneA boot
global$

Example 2-2 Creating a Non-Global Zone With Default Settings

This example shows how a zone named zoneB is created with default settings and based on the following assumptions:

  • The zone uses the default solaris brand.

  • Only the default package is installed, and therefore, no special manifest is created.

  • All necessary rights, both zone related and non-zone related, have been granted.

  • Because no configuration profile is used, system configuration of the zone is completed manually.

global$ pfbash
                        Create the zone.
global$ zonecfg -z zoneB create 
global$

Install the zone.
global$ zoneadm -z zoneB install
                        Boot the zone.
global$ zoneadm -z zoneB boot
                        Connect to console then configure system.
global$ zlogin -C zoneB
[Connected to zone 'zoneB' console]
...
SC profile successfully generated as
/etc/svc/profile/incoming/config/sc_profile.xml

Exiting System Configuration Tool. Log is available at
logfilename
Booting to milestone "all".
Hostname: zone-hostname
zone-hostname console login: 
username
Password: 
password
username@zone-hostname:~$

Log out of zone.
username@zone-hostname:~$ exit
logout

zone-hostname console login: ~.
zone-hostname console login: Connection to global-zone is closed.